312 views

2 Answers

3 votes
3 votes

its O(n3) as the program reaches first time in the third loop it runs for i = n3. and when it comes back to loop2 it finds out that i>n2 now when it comes back to loop 1 it gets i>n so it terminates out making time complexity to be O(n3).

0 votes
0 votes
O(n^3)

because i is common for all three loops .

so

first loop first iteration i=1

second loop first iteration i=1;

third loop i=1   1<n^3

               i=2

            .........................................................

             i=n^3+1<=n^3   false(exit from 3rd loop) till now n^3 times loop is run.       

   n^3+2<n^2  false(exit from second loop)

 n^3+3<n  false(exit from first loop)

soO(n^3)

Related questions

0 votes
0 votes
0 answers
2
0 votes
0 votes
1 answer
3
NeelParekh asked Jul 27, 2023
279 views
If an array is split in the form of increasing and decreasing order then what is TC to find minimum element in the array?
2 votes
2 votes
1 answer
4
h4kr asked Dec 30, 2022
473 views
What is the correct time complexity in $\theta()$ ?