I have a recurrence relation which is like the following:
$$ T(n) = 2T(n/2) + \log_2 n. $$
I am using recursion tree method to solve this. And at the end, i came up with the following equation:
$$ T(n)=(2\log_2 n)(n-1)-(1*2 + 2*2^2 + \ldots + k*2^k) $$ where $k=\log_2 n$.
I am trying to find a theta notation for this equation. But i cannot find a closed formula for the sum $$ 1*2 + 2*2^2 + \ldots + k*2^k.$$
How can i find a big theta notation for $T(n)$?
Thanks.
$$T(n) = 2 T(n/2) + \log_2(n)$$ Let $n=2^m$ and $T(2^m) = g(m)$. Then the recurrence can be rewritten as \begin{align} g(m) & = 2g(m-1) + m\\ & = 2(2g(m-2) + m-1) + m\\ & = 4g(m-2) + 2(m-1) + m\\ & = 4(2g(m-3) + m-2) + 2(m-1) + m\\ & = 8g(m-3) + 4(m-2) + 2(m-1) + m\\ & = 16 g(m-4) + 8(m-3) + 4(m-2) + 2(m-1) + m \end{align} Hence, by induction, we have \begin{align} g(m) & = 2^m g(0) + \sum_{k=1}^m 2^{m-k}k = 2^m g(0) + 2^m \sum_{k=1}^m \dfrac{k}{2^k}\\ & = 2^m g(0) + 2^m \left(2 - \dfrac{m+2}{2^m}\right) = 2^m(2+g(0)) - (m+2) \end{align} where $$\sum_{k=1}^m kx^k = x \dfrac{d}{dx}\left(\sum_{k=0}^m x^k\right) = x \dfrac{dx}{dx} \left(\dfrac{1-x^{m+1}}{1-x}\right) = x \cdot \left(\dfrac{mx^{m+1} - (m+1)x^m+1}{(1-x)^2} \right)$$ Hence, $$T(n) = (2+T(1))n - (2+\log_2(n))$$