in Algorithms retagged by
631 views
0 votes
0 votes

in Algorithms retagged by
631 views

1 Answer

1 vote
1 vote
1st for loop run 1 time

2nd for loop(inner loop )run 2n time

3rd for loop only run 1st time for n time and for next 2n- 1 time it only check condition

So complexity is O(n)

2 Comments

Why 1st for loop run only 1 time?
0
0
as inner loop increment value of i=2*n
0
0

Related questions

0 votes
0 votes
1 answer
1
3 votes
3 votes
1 answer
4