Can You Solve This Recurrence Using the Recursion Tree Method?

  • Thread starter 22990atinesh
  • Start date
  • Tags
    Recurrence
In summary: The terms of the series are:## 2^(n-1), 2^(n-2), ... , 2^(n-i), ... , 2^(n-n) ##The sum is:## 2^(n-1) + 2^(n-2) + ... + 2^(n-i) + ... + 2^(n-n) = (2^(n-1)) (1 + 1/2 + ... + 1/2^(n-1)) = (2^(n-1)) (1 - (1/2)^n)/(1- (1/2)) = 2^n (1 - (1/2)^n) ##The series in
  • #1
22990atinesh
143
1

Homework Statement


##T(n) = 2 T(n-1) + n, n \geq 2##
##T(1) = 1##

Homework Equations

The Attempt at a Solution


I'm using recursion tree method to solve the above recurrence
Ques.jpg


T(n) = Summation of non-leaf nodes + leaf nodes
##T(n) = n + 2(n-1) + 2^2(n-2) + ... + 2^{n-1}##
 
Physics news on Phys.org
  • #3
This thread recurrs thrice.
 
  • #4
Each thread had a separate problem. Maybe they should have been combined.

T(n+1) = T(n) + floor(sqrt(n+1))
T(1) = 1.
(I assumed that ⌊ ⌋ meant the integer floor of the sqrt).

Note that floor(sqrt(1->3)) = 1, floor(sqrt(4 -> 8)) = 2, floor(sqrt(9->15)) = 3, ... .

T(m^2) = m + 1*0 + 3*1 + 5*2 + 7*3 + ... + (2m-1)(m-1)
T(m^2) = m + sum i=1 to m: (2i - 1)(i - 1)

Which is a cubic equation of the form (I'll let you solve this one):

T(m^2) = a m^3 + b m^2 + c m

I don't know if there's a more generic method to solve this.

- - -

T(n) = 2 T(n/2) + 2
T(1)=2
Code:
n=2                               2
                           2             2n=4                               2
                           2             2
                        2     2       2     2  n=8                               2
                           2             2
                        2     2       2     2  
                       2 2   2 2     2 2   2 2

sum i=1 to log2(2n) : 2^i
2 T(n) - T(n) = T(n):

2 T(n) =        4 + 8 + 16 + ... + 2^(log2(2n)) + 2^(log2(4n))
  T(n) =    2 + 4 + 8 + 16 + ... + 2^(log2(2n))
----------------------------------------
  T(n) =   -2                                   + 2^(log2(4n))
  T(n) =   -2                                   + 4n
  T(n) = 4n - 2

- - -

For the summation series in the first post above, I used power series method, subracting 1 x series from 2 x series:
Code:
2(T(n)) =        (2)(n  ) + (2^2)(n-1) + (2^3)(n-2) + ... + 2^(n-1)(2) + 2^(n)
  T(n)  = (1)n + (2)(n-1) + (2^2)(n-2) + (2^3)(n-3) + ... + 2^(n-1)(1)
----------------------------------------------------------------------------
  T(n)  =   -n + (2)      + (2^2)      + (2^3)            + 2^(n-1)    + 2^(n)

2(T(n)+n) =       (2^2) + (2^3) + ... + 2^(n-1) + 2^(n) + 2^(n+1)
  T(n)+n  = (2) + (2^2) + (2^3) + ... + 2^(n-1) + 2^(n)
-----------------------------------------------------------------
  T(n)+n  = -2                                          + 2^(n+1)

T(n) = 2^(n+1) - n - 2
 
Last edited:
  • #5
NascentOxygen said:
This thread recurrs thrice.
The other two copies have been deleted.

Edit: The other two copies were deleted in error. They have been reinstated.
 
Last edited:
  • #6
rcgldr said:
...
For the summation series in the first post above, I used power series method, subracting 1 x series from 2 x series:
Code:
2(T(n)) =        (2)(n  ) + (2^2)(n-1) + (2^3)(n-2) + ... + 2^(n-1)(2) + 2^(n)
  T(n)  = (1)n + (2)(n-1) + (2^2)(n-2) + (2^3)(n-3) + ... + 2^(n-1)(1)
----------------------------------------------------------------------------
  T(n)  =   -n + (2)      + (2^2)      + (2^3)            + 2^(n-1)    + 2^(n)

2(T(n)+n) =       (2^2) + (2^3) + ... + 2^(n-1) + 2^(n) + 2^(n+1)
  T(n)+n  = (2) + (2^2) + (2^3) + ... + 2^(n-1) + 2^(n)
-----------------------------------------------------------------
  T(n)+n  = -2                                          + 2^(n+1)

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

as the height of the tree is n-1. So series would be
##T(n) = n + 2(n-1) + 2^2(n-2) + ... + 2^{n-3}(n-[n-3]) + 2^{n-1}##
on solving with your approach I'm ending up with different ans
##2T(n) - T(n) = T(n) = n + 2 + 2^2 + 2^3 + ... + 2^{n-3} + 2{n-2}(n-[n-3]) + 2^{n-1} + 2##
##T(n) = n -1 - \frac{7}{2} 2^n##
 
  • #7
22990atinesh said:
So series would be
##T(n) = n + 2(n-1) + 2^2(n-2) + ... + 2^{n-3}(n-[n-3]) + 2^{n-1}##
A terms is missing, it should be:

##T(n) = n + 2(n-1) + 2^2(n-2) + ... + 2^{n-3}(3) + 2^{n-2}(2)+ 2^{n-1}##

Then 2 T(n) - T(n) is

## -n + 2 + 2^2 + 2^3 + ... + 2^n ##

and you continue with T(n)+n as shown in my previous post.
 
  • #8
hmm Sorry little mistake

##T(n) = n + 2(n-1) + 2^2(n-2) + ... + 2^{n-2}(n-[n-2]) + 2^{n-1}##
##2*T(n) = 2*n + 2^2(n-1) + 2^3(n-2) + ... + 2^{n-1}(n-[n-2]) + 2^{n}##

##2*T(n) - T(n) = - n + 2 + 2^2 + ... + 2^{n-2} + 2^{n-1} + 2^n##
##T(n) = - n + 2 + 2^2 + ... + 2^{n-2} + 2^{n-1} + 2^n + 2^0 - 2^0##
##T(n) = - n + 2^0 + 2^1 + 2^2 + ... + 2^{n-2} + 2^{n-1} + 2^n - 2^0##
Now We can directly apply sum of GP formula here

##T(n) = - n + \frac{2^{n+1} -1}{2-1} - 2^0##
##T(n) = 2^{n+1} - n - 2##

By the way what is this "Power Series Method". All I can find on internet is "Power Series Method" for differential equations.
 

Related to Can You Solve This Recurrence Using the Recursion Tree Method?

1. What is a recurrence relation?

A recurrence relation is a mathematical relationship that defines a sequence of values based on previous values in the sequence. It is commonly used to model and solve problems in various fields such as computer science, physics, and economics.

2. How do you solve a recurrence relation?

To solve a recurrence relation, you can use various methods such as substitution, iteration, and master theorem. These methods involve finding a closed-form solution for the recurrence, which is a mathematical expression that directly calculates the value of the nth term in the sequence.

3. What is the difference between a linear and a nonlinear recurrence relation?

A linear recurrence relation is one in which the next term in the sequence is a linear combination of the previous terms. In contrast, a nonlinear recurrence relation is one in which the next term is a function of the previous terms, but the function is not linear.

4. Can all recurrence relations be solved?

No, not all recurrence relations can be solved. Some may have no closed-form solution, making it impossible to directly calculate the value of the nth term. In these cases, approximation methods or computer algorithms may be used to estimate the values of the sequence.

5. What are some real-world applications of recurrence relations?

Recurrence relations have a wide range of applications in various fields. One example is in computer science, where they are used to analyze the time complexity of algorithms. They are also used in physics to model oscillating systems and in economics to model population growth and financial systems.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
11
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
8
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
6
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
10
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
6
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
1K
Back
Top