简体   繁体   English

如何计算此函数的增长率:T(n) = 2T(n^(1/2)) + 2(n^(1/2))

[英]How to calculate growth rate of this function: T(n) = 2T(n^(1/2)) + 2(n^(1/2))

I need to calculate the growth rate of this function for my homework:我需要为我的作业计算这个函数的增长率:

T(n) = 2T( n^(1/2) ) + 2( n^(1/2) )

To put it another way:换一种方式:

T(n) = 2T( sqrt(n) ) + 2( sqrt(n) )

Changing variables might help (something like n = 2^m )更改变量可能会有所帮助(类似于n = 2^m

The answer I found is log(n)*log(log(n)) , but I know that is incorrect.我找到的答案是log(n)*log(log(n)) ,但我知道这是不正确的。

n = 2^m is indeed the correct variable substitution to use. n = 2^m确实是要使用的正确变量替换。 Define a function S(m) :定义一个函数S(m)

S(m) = T(n) = T(2^m)

T(sqrt(n)) = T(2^[m/2]) = S(m/2)

S(m) = 2S(m/2) + 2^[m/2+1]

Expansion:扩张:

S(m) =  4*S(m/4)  + 2*2^[m/4+1]  + 2^[m/2+1]
     =  8*S(m/8)  + 4*2^[m/8+1]  + 2^[m/4+2] + 2^[m/2+1]
     = 16*S(m/16) + 8*2^[m/16+1] + 2^[m/8+3] + 2^[m/4+2] + 2^[m/2+1]
     = ...

2^[m/2] will dominate all of the other terms, so: 2^[m/2]将支配所有其他项,因此:

S(m) = O(2^[m/2])

*********************
*                   *
* T(n) = O(sqrt(n)) *
*                   *
*********************

The above can also be derived using the Master Theorem (Case 3).以上也可以使用主定理(案例 3)推导出来。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM