engineering recuitment ISRO Scientist Computer Science Mock Test Algorithms Asymptotic Worst Case Time and Time Complexity
Consider the following C-like code:
for (i -1; i< n; i + +) {
for (j - i; j < i2 ; j + +) {
doSomething();
}
}
What is the time complexity of the block?
Assume doSomething() takes θ(1)
1
θ (n2)
2
θ (n3)
3
θ (n4)
4
θ (n2 logn)