Without performing any calculations, give the worst case time complexity of the following function. Justify your answer.

void f(int n, int m, int L)
{
     int i=k=1, j=m;
     while((i<=n && j>=1) || k<=L)
     {
          i*=2;
          j/=2;
          k++;
     }
}


Difficulty level
This exercise is mostly suitable for students
O(max(min(log_2 (n),log_2 (m)),L))

Back to the list of exercises
Looking for a more challenging exercise, try this one !!
Sorting using quick-sort algorithm