简体   繁体   中英

Finding asymptotic upper and lower bound?

If we assume T(n) is constant for small n, how can we find the solution of this function?

T(n) = T(n−2) + 2logn

So far, I am unable to find a way to represent the whole function. Can you please help me? I really want to understand.

Assuming n is even, and that T(1) = T(0) = 0 .

T(n)/2 = log(n) + log(n-2) + ... + log(2)
       = log((n/2)! * 2^n)
       = n log(2) + log((n/2)!)
       = n log(2) + n log(n) - n + O(log(n)) (Stirling's approximation)

So for n even, T(n) = Theta(n log(n)) .

For n odd, you can note that T(n-1) < T(n) < T(n+1) , and get the same asymptotic bound.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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