edited by
533 views

1 Answer

0 votes
0 votes
O(n) because:

The  count function will get executed like as follows:

for i=n --->    count will execute n times

for i=n/2---->   count will get executed n/2 times

.

.

.

.for i=1-->  count will get executed for 1 time

 

so, we will sum up all of this:

O(n+n/2+n/4+.......1)=O(n)

Related questions

0 votes
0 votes
1 answer
2
0 votes
0 votes
0 answers
3
1 votes
1 votes
1 answer
4
eyeamgj asked Jan 30, 2018
285 views
how the tc is O(n^4)