[英]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) 对于小 n 是常数,我们如何找到这个函数的解?
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
.假设 n 是偶数,并且
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))
.所以对于
n
偶数, 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.对于
n
奇数,您可以注意到T(n-1) < T(n) < T(n+1)
,并获得相同的渐近界。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.