问题
I recently stumbled upon a resource where the 2T(n/2) + n/log n type of recurrences were declared unsolvable by MM.
I accepted it as a lemma, until today, when another resource proved to be a contradiction (in some sense).
As per the resource (link below): Q7 and Q18 in it are the rec. 1 and 2 respectively in the question whereby, the answer to Q7 says it can't be solved by giving the reason 'Polynomial difference b/w f(n) and n^(log a base b)'. On the contrary, answer 18 solves the second recurrence (in the question here) using case 1.
http://www.csd.uwo.ca/~moreno/CS433-CS9624/Resources/master.pdf
Can somebody please clear the confusion?
回答1:
If you try to apply the master theorem to
T(n) = 2T(n/2) + n/log n
You consider a = 2, b = 2
which means logb(a) = 1
- Can you apply case 1?
0 < c < logb(a) = 1
. Isn/logn = O(n^c)
. No, becausen/logn
grow infinitely faster thann^c
- Can you apply case 2? No.
c = 1
You need to find some k > 0 such thatn/log n = Theta(n log^k n )
- Can you apply case 3 ?
c > 1
, isn/logn = Big Omega(n^c)
? No because it is not evenBig Omega(n)
If you try to apply the master theorem to
T(n) = 4T(n/2) + n/log n
You consider a = 4, b = 2
which means logb(a) = 2
Can you apply case 1?
c < logb(a) = 2
. isn/logn = O(n^0)
orn/logn = O(n^1)
. Yes indeedn/logn = O(n)
. Thus we haveT(n) = Theta(n^2)
note: Explanation about 0 < c <1, case 1
The case 1 is more about analytics.
f(x) = x/log(x) , g(x) = x^c , 0< c < 1
f(x) is O(g(x)) if f(x) < M g(x) after some x0, for some M finite, so
f(x) is O(g(x)) if f(x)/g(x) < M cause we know they are positive
This isnt true here We pose y = log x
f2(y) = e^y/y , g2(y) = e^cy , 0< c < 1
f2(y)/g2(y) = (e^y/y) / (e^cy) = e^(1-c)y / y , 0< c < 1
lim inf f2(y)/g2(y) = inf
lim inf f(x)/g(x) = inf
回答2:
This is because in Q18 we have a = 4
and b = 2
, thus we get that n^{log(b,a)} = n^2
which has an exponent strictly bigger than the exponent of the polynomial part of n/log(n)
.
来源:https://stackoverflow.com/questions/28093121/difference-between-solving-tn-2tn-2-n-log-n-and-tn-4tn-2-n-log-n