Show that T(n)=2^{n+1}-1

tamolam8

tamolam8

Answered question

2022-09-04

Show that T ( n ) = 2 n + 1 1.
Show that T ( n ) = 2 n + 1 1, for the following,
T ( n ) = { 1  if,  n = 0   T ( n 1 ) + 2 n  otherwise
I did it as follows,
T ( n ) = T ( n 2 ) + 2 n 1 + 2 n T ( n ) = T ( n 3 ) + 2 n 2 + 2 n 1 + 2 n T ( n ) = T ( n ( n 1 ) ) + 2 n n + + 2 n 1 + 2 n
From the last call, I can see that,
T ( 0 ) = T ( 1 ) + 2 0 + + 2 n 1 + 2 n 1 = T ( 1 ) + 2 0 + + 2 n 1 + 2 n 1 = T ( 1 ) + i = 1 n 2 i 1 = T ( 1 ) + 2 n + 1 1 2 1
How we can get rid of 1 and T(1) as they appeared in my solution please?

Answer & Explanation

Conner Singleton

Conner Singleton

Beginner2022-09-05Added 13 answers

Step 1
Your work contains a number of errors.
First of all, your equation
T ( n 1 ) = T ( n 2 ) + 2 n 1 + 2 n
makes no sense, since
(1) T ( n ) = T ( n 1 ) + 2 n
from the given definition implies
(2) T ( n 1 ) = T ( n 2 ) + 2 n 1 ,
simply by replacing n with n 1.
Step 2
What you probably intended to write is
T ( n ) = T ( n 1 ) + 2 n = ( T ( n 2 ) + 2 n 1 ) + 2 n ,
where we "unfolded" the recursion by substituting Equation (2) into Equation (1). If you do it again, we get
T ( n ) = T ( n 3 ) + 2 n 2 + 2 n 1 + 2 n .
This is what you want to write. The left hand side does not change.
Then a complete unfolding of the recursion gives
T ( n ) = T ( 0 ) + 2 1 + 2 2 + + 2 n ,
and since T ( 0 ) = 1, we get
T ( n ) = k = 0 n 2 k = 2 n + 1 1 2 1 = 2 n + 1 1 ,
as claimed.

Do you have a similar question?

Recalculate according to your conditions!

New Questions in Discrete math

Ask your question.
Get an expert answer.

Let our experts help you. Answer in as fast as 15 minutes.

Didn't find what you were looking for?