2

I'm trying to solve the below recurrence

$$T(n) = 2 T(n/2) + n/\log n$$

I referenced some online articles they all are approximating $n \sum_{i=0}^{h-1} \frac{1}{\log n - i}$ to $n \sum_{i=1}^{h-1} \frac{1}{i}$

$n \sum_{i=0}^{h-1} \frac{1}{\log n - i} = n \sum_{i=1}^{h-1} \frac{1}{i}$

I'm not getting how they are doing it, Can anybody explain. Below are the some references where I found it.

Link 1 (Example 5)

Link 2 (Example 1.1)

janmarqz
  • 10,538
Atinesh
  • 1,239

1 Answers1

1

In your first link they considered a $\,\lg(x):=\log_2(x)=\dfrac{\log(x)}{\log(2)}\;$ function and their derivation was :

\begin{align} T(n)&= 2\,T(n/2) + \frac n{\lg(n)}\\ &=2\left(2\,T(n/4) + \frac {n/2}{\lg(n/2)}\right) + \frac n{\lg(n)}\\ &=4\,T(n/4) + \frac {n}{\lg(n)-\lg(2)} + \frac n{\lg(n)}\\ &=4\left(2\,T(n/8) + \frac {n/4}{\lg(n/4)}\right) + \frac {n}{\lg(n)-1} + \frac n{\lg(n)}\\ &\text{ $(\,\lg(2^{\,k})=k\;$ was used )}\\ &=8\,T(n/8) + \frac {n}{\lg(n)-2} + \frac {n}{\lg(n)-1} + \frac n{\lg(n)}\\ &=\cdots\\ &=2^{\,\lg{n}}\,T(1) + \sum_{i=0}^{\,\lg{n/2}}\frac {n}{\lg(n)-i}\\ &\text{ ($\;n=2^m,\,m\in\mathbb{N}\,$ was supposed )}\\ &=n\,T(1) + n\sum_{i=0}^{\,\lg(n)-1}\frac {1}{\lg(n)-i}\\ &\text{ consider the complementary $\;j:=\lg(n)-i\;$ then}\\ &=n\,T(1) + n\sum_{j=\lg(n)}^{\,1}\frac {1}{j}\\ \end{align} (the denominator should be $j$ and not $\lg(n)\,$ and the order of terms reversed at this point!)

The harmonic sum behaves like $\lg($number of terms$)$ so that this should indeed be of order $n\lg(\lg(n))$.

Raymond Manzoni
  • 43,021
  • 5
  • 86
  • 140