How to solve this recurrence relation: T(n) = 4*T(sqrt(n)) + n

前端 未结 4 995
我在风中等你
我在风中等你 2020-12-22 07:46

I know how to solve the recurrence relations using Master Method. Also I\'m aware of how to solve the recurrences below:

T(n) = sqrt(n)*T(sqrt(n)) + n

T(n) =

4条回答
  •  长情又很酷
    2020-12-22 08:33

    T(n) = 4T(√n) + n 
    suppose that (n = 2^m) . so we have :
    T(2^m) = 4T(2^(m/2)) + (2^m)
    now let name T(2^m) as S(m):
    S(m) = 4S(m/2) + m . now with master Method we can solve this relation, and the answer is :
    S(m) = Θ(m^2) 
    now we step back to T(2^m):
    T(2^m) = Θ((2^m)^2)
    now we need m to solve our problem and we can get it from the second line and we have :
    n = 2^m   =>   m=lgn 
    and the problem solved .
    T(n) = Θ((2^lgn)^2)
    T(n) = Θ(n^2)
    

提交回复
热议问题