1,619 views
1 votes
1 votes
T(n)=T(n/2)+2; T(1)=1

when n is power of 2 the correct expression for T(n) is:

a) 2(logn+1)

b) 2logn

c)logn+1

d)2logn+1

1 Answer

3 votes
3 votes

let n be 2k

T(2k )=T(2k-1 )+2

put k=1 to get T(1)=1

T(2)=T(1)+2

T(2)=3 as T(1)=1

put n value as 2 in option D

2log2+1=3

Hence verified it will not satisfy any other option

 

Related questions

1 votes
1 votes
2 answers
2
5 votes
5 votes
1 answer
3
0 votes
0 votes
1 answer
4
lucasbbs asked Feb 28, 2022
6,879 views
How do I apply the master theorem in the above recurrence? Please give details about which case and on hiow to solve the asymptotic analysis...