T(n) = 2T(n/2) + nlgn的渐近上界和下界是什么?

时间:2021-08-21 21:28:02

The recurrence relation

的递归关系

T(n) = 2T(n/2) + n lg lg n

T(n) = 2T(n/2) + nlgn。

(where lg is logarithm to base 2) can be solved using the master theorem but I am not very sure about the answer. I have found my answer but am not mentioning it here in order to prevent information cascades. Please help me find the big O and Ω for above.

(lg是log以2为底的对数)可以用主定理求解,但我不太确定答案。我已经找到了我的答案,但我并没有在这里提到它,以防止信息级联。请帮我找到上面的大O和。

1 个解决方案

#1


3  

None of the 3 cases in the master theorem apply for

主定理中的3个案例都不适用。

T(n)=2 T(n/2) + n log(log n)

(With arbitrary base, it doesn't really matter)

(带有任意的碱基,这并不重要)

Case 1: f(n)=n log(log n) is 'bigger' than nlog2 2=n1

案例1:f(n)=n log(log n)大于nlog2 =n1。

Case 2: f(n) does not fit n logk(n)

情形2:f(n)不符合n logk(n)

Case 3: f(n) is smaller than n1+e

情形3:f(n)小于n1+e。

U(n)=2 U(n/2) + n log n
L(n)=2 L(n/2) + n

You can show that: U(n) >= T(n) and L(n) <= T(n). So U gives a upper bound, and L a lower bound for T.

你可以证明:U(n) >= T(n)和L(n) <= T(n)。所以U给出了上界,而L是T的下界。

Applying the master theorem for U(n), gives

为U(n)应用主定理,给出。

Case 2: f(n)=n log n=Θ(n1 log1 n) thus U(n)=Θ(n log2 n)

案例2:f(n)= n o(log n)=Θ(n1 log1 n)因此U(n)=Θ(n log2 n)

Applying the master theorem for L(n), gives

给出了L(n)的主定理。

Case 2: f(n)=n =Θ(n1 log0 n) thus L(n)=Θ(n log n)

案例2:f(n)= n =Θ(n1 log0 n)因此L(n)=Θ(n o(log n))

Because L(n)<=T(n)<=U(n) it follows that T(n)=O(n log2 n) and T(n)=Ω(n log n)

因为L(n)< = T(n)< = U(n),T(n)= O(n log2 n)和T(n)=Ω(n O(log n))

Also, note that O(log2n)=O((log n)/log 2)=O((log n) * c)=O(log n).

另外,注意O(log2n)=O((log n)/log 2)=O((log n) * c)=O(log n)。

#1


3  

None of the 3 cases in the master theorem apply for

主定理中的3个案例都不适用。

T(n)=2 T(n/2) + n log(log n)

(With arbitrary base, it doesn't really matter)

(带有任意的碱基,这并不重要)

Case 1: f(n)=n log(log n) is 'bigger' than nlog2 2=n1

案例1:f(n)=n log(log n)大于nlog2 =n1。

Case 2: f(n) does not fit n logk(n)

情形2:f(n)不符合n logk(n)

Case 3: f(n) is smaller than n1+e

情形3:f(n)小于n1+e。

U(n)=2 U(n/2) + n log n
L(n)=2 L(n/2) + n

You can show that: U(n) >= T(n) and L(n) <= T(n). So U gives a upper bound, and L a lower bound for T.

你可以证明:U(n) >= T(n)和L(n) <= T(n)。所以U给出了上界,而L是T的下界。

Applying the master theorem for U(n), gives

为U(n)应用主定理,给出。

Case 2: f(n)=n log n=Θ(n1 log1 n) thus U(n)=Θ(n log2 n)

案例2:f(n)= n o(log n)=Θ(n1 log1 n)因此U(n)=Θ(n log2 n)

Applying the master theorem for L(n), gives

给出了L(n)的主定理。

Case 2: f(n)=n =Θ(n1 log0 n) thus L(n)=Θ(n log n)

案例2:f(n)= n =Θ(n1 log0 n)因此L(n)=Θ(n o(log n))

Because L(n)<=T(n)<=U(n) it follows that T(n)=O(n log2 n) and T(n)=Ω(n log n)

因为L(n)< = T(n)< = U(n),T(n)= O(n log2 n)和T(n)=Ω(n O(log n))

Also, note that O(log2n)=O((log n)/log 2)=O((log n) * c)=O(log n).

另外,注意O(log2n)=O((log n)/log 2)=O((log n) * c)=O(log n)。