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

void function(int n){
     int i =1;
     while(i<n){
           int j=n;
           while(j>0)
               j/=2;
           i*=2;
     }
}


Difficulty level
This exercise is mostly suitable for students
O(log(n)*log(n))

Back to the list of exercises
Looking for a more challenging exercise, try this one !!
Implementation of a stack to hold elements of 2 different types