How to solve a recurrence relation such as $T(n) = 2T(\frac{n}{2}) +$ $\frac{n}{\log (n)}$?

309 Views Asked by At

Wikipedia says that the equation cannot be solved using Master's Method.
The equation matches with Master's Theorem except for $\frac {n}{\log(n)}$.

A youTube tutor (seek time 11:42) solves this using Master's Method as :

$T(n)=2T(\frac{n}{2})+\frac{n}{\log(n)}$
$T(n)=2T(\frac{n}{2})+n \log^{-1}n$

$a=2,b=2,k=1,p=-1$

Therefore,
$T(n)=\theta(n^{\log_ab}\log(\log(n)))$
$T(n)=\theta(n\log\log(n))$

Is it correct? because I don't think $\frac{n}{\log(n)}$ can be transformed into $n\log^{-1}n$.

A 3rd source has solved it using a completely different approach currently beyond my understanding but the answer matches with the one solved in the youTube video.

Is the approach by the guy in the youtube video correct? Can logarithms be solved that way? If not, then how would you solve the problem?

1

There are 1 best solutions below

5
On

My first impulse would be to note that $$\frac{T(n)}n=\frac{T(n/2)}{n/2}+\frac1{\log n},$$ and that to be able to iterate this requires to look at the powers of $2$, since the new sequence $$S(k)=\frac{T(2^k)}{2^k}$$ solves the recursion $$S(k)=S(k-1)+\frac1{k\log 2},$$ from which I readily see that $$S(k)=S(0)+\frac1{\log 2}\sum_{i=1}^k\frac1i=S(0)+\frac{H_k}{\log2},$$ where $H_k$ denotes the $k$th harmonic number. Coming back to $T$ and using the asymptotics of $H_k$ yields $$T(2^k)=2^k\left(T(1)+\frac{H_k}{\log2}\right)=\Theta(2^k\log k).$$ All this is rigorous but now comes the nonrigorous part, which is to declare (although this is not true without some further hypothesis) that, since $\log k=\log\log 2^k-\log\log2\in\Theta(\log\log n)$, this implies $$T(n)\in\Theta(n\log\log n).$$