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)

Sponsored

hivanix.in

Visit

This quiz is brought to you by hivanix.in

🌐 Web App Development

Quick Navigation