I came across following problem:
Find the time complexity of below recurrence relation:
$T(n)=\begin{cases} & 2T(n/2)+C; & n>1\\ & C;&n=1 \\ \end{cases}$
The solution was given as follows
$\begin{align} T(n) & = C+2C+4C+...nC\\ & = C (1+2+4+...+2^k) \\ & = C \left(\frac{1(2^{k+1}-1)}{2-1}\right) \\ & = C (2^{k+1}-1) \\ & = C (2n-1) \\ & = O(n) \\ \end{align}$
I feel above gives order of return value, but not the order of computation involved.
This function makes two recursive calls with argument $n/2$. Each of these two make another two recursive calls, making total 4, with argument $n/2/2=n/4$. Each of these four make another two recursive calls, making total 8, with argument $n/2/2/2=n/8$. And so on. Thus this form complete binary tree. This tree terminates when $n/2^h=1$. That is, when $2^h=n$.
$\therefore $ Height of binary tree $h=\log_2n$.
And the order of computation will be, number of nodes in the complete binary tree for height $h$ which equals $2^{h+1}-1=2^{\log_2n+1}-1=O(2^{\log_2n})$.
Am I correct with this final time complexity and the overall interpretation (of first being the time complexity of the return value and the one which I came up with, the time complexity of computation involved)?