简体   繁体   English

使用主法求解T(n)= 2T(n / 2)+ n / log n和T(n)= 4T(n / 2)+ n / log n之间的差异

[英]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. 我最近偶然发现了一个资源,其中MM的2T(n / 2)+ n / log n 类型的重复被宣布无法解析。

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. 根据资源(下面的链接):其中的Q7和Q18是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)'. 分别在问题1和2中,Q7的答案表明它不能通过给出'多项式差异b / wf(n)和n ^(记录基数b)'的原因来解决。 On the contrary, answer 18 solves the second recurrence (in the question here) using case 1. 相反,答案18使用案例1解决了第二次复发(在这里的问题中)。

http://www.csd.uwo.ca/~moreno/CS433-CS9624/Resources/master.pdf 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 你考虑a = 2, b = 2 ,这意味着logb(a) = 1

  1. Can you apply case 1? 你可以申请案例1吗? 0 < c < logb(a) = 1 . 0 < c < logb(a) = 1 Is n/logn = O(n^c) . n/logn = O(n^c) No, because n/logn grow infinitely faster than n^c 不,因为n/logn增长速度比n^c快得多
  2. Can you apply case 2? 你可以申请案例2吗? No. c = 1 You need to find some k > 0 such that n/log n = Theta(n log^kn ) 编号c = 1你需要找到一些k> 0,这样n/log n = Theta(n log^kn )
  3. Can you apply case 3 ? 你可以申请案例3吗? c > 1 , is n/logn = Big Omega(n^c) ? c > 1 ,是n/logn = Big Omega(n^c) No because it is not even Big Omega(n) 不,因为它甚至不是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 您认为a = 4, b = 2 ,这意味着logb(a) = 2

  1. Can you apply case 1? 你可以申请案例1吗? c < logb(a) = 2 . c < logb(a) = 2 is n/logn = O(n^0) or n/logn = O(n^1) . n/logn = O(n^0)n/logn = O(n^1) Yes indeed n/logn = O(n) . 是的确n/logn = O(n) Thus we have 因此,我们有

     T(n) = Theta(n^2) 

note: Explanation about 0 < c <1, case 1 注意:关于0 <c <1,案例1的说明

The case 1 is more about analytics. 案例1更多地是关于分析。

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 这不是真的,我们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)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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