Given, $T(n) = 2T(\lfloor{n/2}\rfloor + 17) + n$. Show that the solution to T(n) is $O(n\lg(n))$.
Here's what I tried -
Assumption: $T(\lfloor n/2 \rfloor) \le c(\lfloor n/2\rfloor + 17)\cdot \lg(\lfloor n/2 \rfloor + 17)$ for some constant $c$ and for some $n \ge n_0$
Inductive step:
$$ \begin{split} T(n) &\le 2c(\lfloor n/2\rfloor + 17) \lg(\lfloor n/2\rfloor + 17) + n \\ & \le 2 c (n/2 + 17)\lg(n/2 + 17) + n \\ & \le c (n + 34) \lg((n+34)/2) + n \\ & = c(n+34)\lg(n+34) - cn - 34c + n \\ & \le c (n + 34)\lg(n + 34) \quad \text{(for $c \ge 1$)} \end{split}$$
So I am stuck here... how do I 'remove' the $34$s from this inequality? (This is exercise 4.3-6 of CLRS)
(Thanks @user137481)
The above reduces to $T(n) <= cn.lg(n) + cn$ which is not quite $O(nlg(n))$. As described in CLRS, in such situations even if the inductive hypothesis is correct, we may not be able to arrive at the exact form. In this case we are offset by a lower order term $cn$ needs to be removed. So the new guess is $T(n) <= cnlg(n) - dn$, (this is still,of course, $O(nlg(n)$). Now,
$T(n) \le 2.c.(\lfloor n/2\rfloor + 17).lg(\lfloor n/2\rfloor + 17) - 2dn + n$
$ \le 2.c.(n/2 + 17).lg(n/2 + 17) -2dn + n$
$= c(n+34).lg(n+34) - c(n+34) - 2dn + n$
$\le 2cn.lg(2n)-2cn-2dn+n\;$ (for $n>=34$)
$=cn.lg(n) - cn + dn +n\;$ (absorbing 2 into c)
$\le cn.lg(n)\;$ (for all $c - d \ge 1$)
Therefore, $T(n) = O(n.lg(n))$
(This is what I have done, if there is any mistake, please correct me, if not, I will rewrite this as an answer and accept it).
\lg nis the way to write $\lg n$. And those dots are not necessary: implied multiplication is understood. If you really think they are necessary, use\cdotto make the dot centered. Also see MathJax tutorial – Sep 07 '14 at 22:42