campus placement AMCAT Mock Test Algorithms Asymptotic Worst Case Time and Time Complexity Introduction
Consider the program
void function(int n) {
int i, j, count=0;
for (i=n/2; i <= n; i++)
for (j = 1; j <= n; j = j*2)
count++;
}
The complexity of the program is
1
O(log n)
2
O(n2)
3
O(n2logn)
4
O(n log n)