What is the running time of the following piece of code ?

for(i=1; i<=n; i++)
{
     res=x+y+x+res;
     if((T[i]+k)<b)
          for(j=1; j<=n; j++)
               res=res+T[j];
     else
          res=res+T[i];
}


Difficulty level
This exercise is mostly suitable for students
O(n^2)

Back to the list of exercises
Looking for a more challenging exercise, try this one !!
Dijkstra Algorithm