Asked this at programmers Stack Exchange, was recommend to ask here :
What would be the big o for the algo:
for (i=0; i < n*n; i++)
for(j=0; j<i*i; j++)
As per my understanding 1st loop will loop upto n^2 times. 2nd loop will go around n^2 times.
Am I right or is it a O(n^6) representation.
Also is there a easy way to say when to use log. I have assumed that whenever the loop variable is multiplied the ln function is applied
eg: for (i=1; i<n*n i=i*2)
Big o for the loop as per my understanding is O(ln n^2) ( Am I right again?)
Please clarify, thanks in advance