Solve Recurrence Relation for Maximum and Minimum in an Array. I know that recursive equation of this algo  is
$T\left ( n \right )=2T\left ( \frac{n}{2} \right )+2 $
Given that $T\left ( 1 \right )=0,T\left ( 2 \right )=1 $
and its solution is also given here, ijust want to clear my doubt where i am stuck at..
I solved this eqtn as--:
$\Rightarrow T\left ( n \right )=2\left ( 2*T\left ( \frac{n}{4} \right )+2  \right )+2 $
$\Rightarrow T\left ( n \right )=2^{2}+T\left ( \frac{n}{2^{2}} \right )+2^{2}+2^{1}$
$\vdots$
$\Rightarrow T\left ( n \right )=2^{k}*T\left ( \frac{n}{2^{k}} \right )+2^{k}+\cdots 2^{2}+2^{1}$
Taking $T\left ( 1 \right )=0 $
$\frac{n}{2^{k}}=1 \Rightarrow k=\log_{2}n $
And our equation becomes
$2^{k}+2^{k-1}+\cdots 2^{2}+2^{1} = \frac{2*\left ( 1-2^{k} \right )}{1-2}=2n-2 ,\left \{  2^{k}=2^{log_{2}n}=n\right \} $
But answer is $\frac{3*n}{2}-2$..please correct me in this equation.

Changing my  base case  from $T\left ( 1 \right )=0$  to $T\left ( 2 \right )=1 $ .my equation looks like
$\Rightarrow T\left ( n \right )=2^{k}*T\left ( \frac{n}{2^{k}} \right )+2^{k}+\cdots 2^{2}+2^{1}$
Taking $T\left ( 2 \right )=1 $
$\frac{n}{2^{k}}=2 \Rightarrow k=\log_{2}\frac{n}{2} $
And our equation becomes 
$T\left(n \right)=2^{k}+2^{k}+2^{k-1}+\cdots 2^{2}+2^{1}$ 
$2^{k}=\frac{n}{2}$
$T\left(n \right)=2^{k}+\sum_{j=1}^{j=k}2^{j}$
$T\left(n \right)=2^{k}+2*\frac{2^{k}-1}{2-1}$
$T\left(n \right)=\frac{n}{2} +2*\left(\frac{n}{2} -1 \right) $
$T\left(n \right)=\frac{3n}{2}-2$
