If you try to apply the main 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 . Is n/logn = O(n^c) . No, because n/logn grows infinitely faster than n^c - Can you apply case 2? No.
c = 1 You need to find k> 0 so that n/log n = Theta(n log^kn ) - Can you apply case 3?
c > 1 , n/logn = Big Omega(n^c) ? No, because it's not even Big Omega(n)
If you try to apply the main 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 . 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
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 is not true. We represent 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
Umnyobe
source share