Answer to Question #256966 in Algorithms for sasha

Question #256966

(ii) Solve the following recurrence relation using Recurrence Tree Method.

T(n) ={1 if n = 1

T(n/2 ) + n if n > 1}


Show all the steps.


1
Expert's answer
2021-10-26T14:19:03-0400

The recursion tree for the given recurrence relation is-

"T(n)- d\\\\\n\\downarrow\n \n\\\\\nT(\\dfrac{n}{2})-d\n\\\\\\downarrow\\\\\n\n\n\nT(\\dfrac{n}{4})-d\n\n\\\\\\downarrow\\\\\n\n\nT(1)-d\n\\downarrow"


we go like "n,\\dfrac{n}{2},\\dfrac{n}{4},\\dfrac{n}{8}...1"


or "2^k=n, k=log_2n"


So we sum d+d+d.. for "log_2n" terms complexity "=0 (log_2n)=0(log_2n)"

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS