edited by
25,567 views
7 votes
7 votes
find TC  : $T(n)= 2T(\sqrt{n}) + 1$
edited by

2 Answers

12 votes
12 votes

T(n) = 2T(√n) + 1

assume n = 2k

T(2K) = 2T(2k)1/2 + 1

T(2K) = 2T(2k/2)+ 1

assume T(2K)  = S(K)

S(K)  = 2S(K/2) + 1

apply extended master theorem 1

a = 2  b = 2 

S(K)= KLOG22

S(K)= ⊖(K1

but S(K)=T(2K)

T(2K) = ⊖(K1 )

but n = 2k

K = Logn

so, putting value  we, get

T(n)  = ⊖( logn) is answer....

edited by

Related questions

1 votes
1 votes
0 answers
1
syncronizing asked Mar 15, 2019
1,300 views
Is this the correct way to solve ?Q) int algorithm(int n){ int sum =0;k,j; for (k=0;k<n/2;k++) for(j=0;j<10;j++) sum++; return 4*algorithm(n/2)*algorit...
1 votes
1 votes
1 answer
2
VikramRB asked Jan 20, 2019
1,043 views
What is the time complexity of the following recurrence relation and step to derive the same$T(n) = T(\sqrt{n}) + log(logn)$
0 votes
0 votes
0 answers
4
garvit_vijai asked Nov 17, 2018
468 views
How to solve the following recurrence relation?T(n) = T(n-6) + n2 , n>7T(n) = 1 , n<= 7