What is the running time of the following piece of code ?
for(i=n; i>0; i/=2){ for(j=1; j<n; j*=2) { for(k=0; k<n; k+=2) sum=sum+1; }}
Difficulty level
This exercise is mostly suitable for students
O(n*(log(n))^2)
Back to the list of exercises
Looking for a more challenging exercise, try this one !!
Interchange diagonals of a square matrix