Monday, June 20, 2011

Time complexity

Source

What is the time complexity of following function fun()? Assume that log(x) returns log value in base 2.

void fun()
{
int i, j;
for (i=1; i<=n; i++)
for (j=1; j<=log(i); j++)
printf("GeeksforGeeks");
}

No comments:

Post a Comment