Question & Answer: Hi, can you use the iterative substitution method to derive the runtime of the following recurrence?…..

Hi, can you use the iterative substitution method to derive the runtime of the following recurrence?

T(n) = 4T(n/2) + lgn

thank you

Expert Answer

 

T(n) = 4T(n/2) + n2
     = n2 + 4[4T(n/4) + n²/4]
     = 2n2 + 16T(n/4)  
     = k⋅n2 + 4kT(n/2k) 
     = ...

up series will end when 2k = n.
k = log2n —taking logarthmic

after substitution k.n2 becomes n2logn , 4kT(n/2k) this will evaluate to n2 as n2logn  asymptotically greater than n2 so answer evaluates to

T(n) = O(n2logn)

Still stressed from student homework?
Get quality assistance from academic writers!