What is the complexity of:
int f4(int n)
{
int i, j, k=1, count = 0;
for(i = 0; i < n; i++)
{
k *= 3;
for(j = k; j; j /= 2)
count++;
}
return count;
}
I know it is O(n^2) but how do you calculate this? and why isn't it n*log n?