简体   繁体   中英

Difference between solving T(n) = 2T(n/2) + n/log n and T(n) = 4T(n/2) + n/log n using Master Method

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/wf(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?

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

  1. Can you apply case 1? 0 < c < logb(a) = 1 . Is n/logn = O(n^c) . No, because n/logn grow infinitely faster than n^c
  2. Can you apply case 2? No. c = 1 You need to find some k > 0 such that n/log n = Theta(n log^kn )
  3. Can you apply case 3 ? c > 1 , is n/logn = Big Omega(n^c) ? No because it is not even Big 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

  1. Can you apply case 1? c < logb(a) = 2 . is n/logn = O(n^0) or n/logn = O(n^1) . Yes indeed n/logn = O(n) . Thus we have

     T(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

这是因为在Q18中我们得到a = 4b = 2 ,因此得到n^{log(b,a)} = n^2 ,其指数严格大于n/log(n)的多项式部分的指数n/log(n)

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