campus placement AMCAT Mock Test Algorithms Asymptotic Worst Case Time and Time Complexity Introduction
int Fun (int n)
{
int temp;
temp = 0;
for (int i = 1; i <= n; i= i*2 )
for (int j = 0; j < i; j++)
temp += 1;
return temp;
}
What is the time complexity of the above function?
1
O (n2)
2
O (n log n)
3
O (n)
4
None of these