in Algorithms retagged by
377 views
0 votes
0 votes

Will the complexity of the function be $\Theta n^{2} or \Theta n^{3}?$

in Algorithms retagged by
by
377 views

4 Comments

Time complexity is calculated for large value of input. For large value of n else loop will run which is covered by outer for loop. So $O(n^{2})$
1
1

  What if there was no else part? Will then the answer be θ($n^{3}$)?

0
0
Yes..If there was no if and else then it will be $O(n^{3})$
1
1

Please log in or register to answer this question.

Related questions