retagged by
535 views
1 votes
1 votes
Complexity of equation -

T(n)=.    2T(n-1)-1   if n>0

              1.                 Otherwise
retagged by

2 Answers

0 votes
0 votes

T(n)=2T(n-1) - 1, n>0

T(0)=1

T(n)=2T(n-1)-1

T(n)=2(2(T(n-2)-1)-1  = 22T(n-2)-3        // T(n-1)=2T(n-2)-1                                  

T(n)=2(2(2T(n-3)-1))-3 = 23T(n-3)-7                                         //  T(n-2)=2T(n-3)-1                         

T(n)=2kT(n-k)-(2k-1)

When n=k

T(n)=2nT(0)-(2n-1)= 2n-2n+1=1=O(1)

Related questions

0 votes
0 votes
1 answer
1
Çșȇ ʛấẗẻ asked Mar 14, 2023
433 views
Solve the following recurrences using recursion tree method and write the asymptotic time complexity T(n)=T(n/2)+n^2
1 votes
1 votes
0 answers
2
srestha asked May 19, 2019
646 views
Let $A(n)$ denotes the number of $n$ bit binary strings which have no pair of consecutive $1’s.$ what will be recurrence relation for it and what will be it’s Time Co...
0 votes
0 votes
0 answers
3
eyeamgj asked Nov 19, 2018
521 views
WHAT IS RECURRENCE RELATION ?I M GETTING T(n-2)+1
0 votes
0 votes
1 answer
4
Vipin Rai asked Nov 12, 2018
248 views
What is order of T(n) ?T(n) = T(n-1) + 2$^{n}$ , n>1T(n) = 1 , n=1A) O(2$^{n}$)B) O(n.2$^{n}$)C) O(2$^{2n}$)