Solve the recurrence: t(n) = t(n/2) + n + 2 (Solution included).

  • Thread starter Thread starter s3a
  • Start date Start date
  • Tags Tags
    Recurrence
AI Thread Summary
The discussion revolves around solving the recurrence relation t(n) = t(n/2) + n + 2. A participant expresses confusion about the solution, particularly at step (4), where they deduce that k = log2(n). Another user points out that a "+" sign is missing in step (4), which is crucial for the correct formulation. They also clarify the transition from step (5) to (6) by explaining the relationship between n/2k-1 and n. The conversation emphasizes the importance of correctly interpreting each step in the recurrence solution process.
s3a
Messages
814
Reaction score
8

Homework Statement


The problem along with its solution is attached as Problem.jpg.

Homework Equations


Recurrence relation.

The Attempt at a Solution


I am confused as to what the solution is stating. I get up to and including (3) but I am stuck at (4). After (4), I get that k = log2(n) because n = 2^k = 2^(log2(n)) = n.

I would greatly appreciate it if someone could help me get unstuck!
Thanks in advance!
 

Attachments

  • Problem.jpg
    Problem.jpg
    20.2 KB · Views: 506
Last edited:
Physics news on Phys.org
s3a said:

Homework Statement


The problem along with its solution is attached as Problem.jpg.

Homework Equations


Recurrence relation.

The Attempt at a Solution


I am confused as to what the solution is stating. I get up to and including (3) but I am stuck at (4). After (4), I get that k = log2(n) because n = 2^k = 2^(log2(n)) = n.

I would greatly appreciate it if someone could help me get unstuck!
Thanks in advance!

You forgot to attach Problem.jpg.
 
Lol. Thanks for telling me.
 
Seems there is a "+" sign missing in (4).
koZTB.gif


It should be t(n/2k) +[/color] n + n/2 + ...

Then in going from (5) to (6), make use of the fact that
n/2k-1 ≡ n/(2k/2)
   ≡ 2n/2k, but k=log2n
   ≡ 2n/n
   ≡ 2 
 
Back
Top