$T(n) = T(n-2) +2 \log(n)$ if n>1 & 1 if n=1
So I start by substituting 3 times to get an idea about the pattern:
$T(n)=T(n-4) + 2 \log(n-2) + 2 \log n$
$T(n)=T(n-6) + 2\log(n-4) + 2\log(n-2) + 2\log n$
After k steps this will be:
- $T(n)=T(n-2k) + 2\log(n-(2k-2)) + 2\log(n - (2k-4)) + \dots + 2\log n$
Now Since $T(1) = 1$, I put :
$$n-2k=1 \iff k = (n-1)/2$$
Which gives :
$$T(n) = T(1) + 2 (\log 3 + \log 5 + \log 7 + \log 9 + \dots + \log n)$$
I don't know how to solve this logarithmic series , I do know the answer is $O(n \log n)$ but how do we reach there can someone please help me here.
The sum of logs is approximated (very well) by the integral $\int_1^n \log x d x = x \log x - x.$