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)dT(n2)dT(n4)dT(1)dT(n)- d\\ \downarrow \\ T(\dfrac{n}{2})-d \\\downarrow\\ T(\dfrac{n}{4})-d \\\downarrow\\ T(1)-d \downarrow


we go like n,n2,n4,n8...1n,\dfrac{n}{2},\dfrac{n}{4},\dfrac{n}{8}...1


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


So we sum d+d+d.. for log2nlog_2n terms complexity =0(log2n)=0(log2n)=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!
LATEST TUTORIALS
APPROVED BY CLIENTS