我试图找到以下的重复运行时间:
T(n) = n^(1/2)T(n^(1/2)) + n
但我无法找到总和甚至是将g(n)与递归总和联系起来的等式。有人可以帮我总结一下吗?
答案 0 :(得分:0)
T(n)=n^(1/2) T(n^(1/2)+n
=n^(1/2)[ n^(1/2^2)T(n^(1/2^2)+n^(1/2)]+n
=n^(3/2^2)T(n^(1/2^2)+2n
=n^(3/2^2)[n^1/2^3 T(n^(1/2^3)+n^(1/2^3)]+2n
= and so on
assume n^(1/2^k)=2
1/2^k logn=1
logn=2k
log logn = k
= n^(1-1/2^k)T(n^(1/2^k)+kn
= n/n(1/2^k)T(2)+kn
= n/2*2+nloglogn
=n+nloglogn
= O(nloglogn)
答案 1 :(得分:0)