Time complexity of function vs return value I came across following problem:


  Find the time complexity of below recurrence relation:  
  
  $T(n)=\begin{cases}
 &amp; 2T(n/2)+C; &amp; n&gt;1\\
 &amp; C;&amp;n=1 \\ 
\end{cases}$


The solution was given as follows


  $\begin{align}
T(n) &amp; = C+2C+4C+...nC\\
     &amp; = C (1+2+4+...+2^k)  \\ 
     &amp; = C \left(\frac{1(2^{k+1}-1)}{2-1}\right) \\ 
     &amp; = C (2^{k+1}-1)   \\ 
     &amp; = C (2n-1)   \\ 
     &amp; = 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)?
Here is a correct version of your original problem. 


  Find the time complexity of an algorithm which takes $T(n)$ time/operations to finish when the input size is $n$, where $T(n)$ satisfies the below initial condition,
  
  $$T(1) = C$$
  and the below recurrence relation,
  $$T(n) = 2T(n/2)+C\ \text{ if } n&gt;1$$
  for some constant $C&gt;0$.  


Another correct version would be "Find the asymptotics in term of big $O$ or $\Omega$ notation for the function $T(n)$ that ...".

My answer is based on the above editions of the your original problem.

Your question and much more beyond have been answered in more generality in this reference question and answer and in particular, by the first case of the master theorem.

Assume throughout this answer and the question that $n$ is a positive integer and "/" is the integer division when it is applied to two positive integers as in Python/Java/C/C++/C#. Without these assumptions, $T(1.5)$ and $T(3)$ may not be defined.

Here is a correct computation.
Suppose $2^h\le n\lt 2^{h+1}$ for some nonnegative integer $h$.
\begin{align}
T(n) &amp; = 2T(n/2) + (2^1-1)C\\
     &amp; = 2(2T(n/4) +C)+ (2^1-1)C\\ 
     &amp; = 2^2T(n/2^2) + (2^2-1)C\\ 
     &amp; \cdots\\ 
     &amp; = 2^hT(1) + (2^h-1)C\\  
     &amp; = (2^{h+1}-1)C\\ 
     &amp; = \Omega(n) 
\end{align}
The last equality stands from the fact that $Cn\le (2^{h+1}-1)C\lt 2Cn$.