I have this piece of code, and I would like to find its temporary complexity. I am getting ready for an interview, and I think it is a little complicated.
int foo (int n)
{
int sum = 0;
int k, i, j;
int t = 2;
for (i=n/2; i>0; i/=2)
{
for(j=0; j<i; j++)
{
for(k=0; k<log2(t-1); k++)
{
sum += bar(sum);
}
}
t = pow(2, i);
}
}
I do not know why, but I cannot relate this expression and find complexity.
Any help on resolving this issue?
source
share