I was just reading another question and this code intrigued me:
for(i = 0; i < n; i++)
{
for(j = 0; j < i*i; j++)
{
for(k = 0; k < i*j; k++)
{
pseudo_inner_count++;
for(l = 0; l < 10; l++);
}
}
}
I don't understand how this can be O(N^6). Can someone break it down for me?
Actually it is:
The loops are nested so we have to multiply these together (do you understand why?). The total is O(N)*O(N^2)*O(N^3) = O(N^6).