I came u with the following equation:
$T(2) = 1$
$T(n) = \lfloor \frac {n} {2}\rfloor + T(\lceil \frac{n}{2} \rceil) | n ∈ \mathbb N$
But I can't find a way to solve it. Is there one?
I need to proof that the solution is right, so I can't just look at the numerical sequence of the equation.
First, calculate the first few numbers in the sequence:
$T(3)=1+T(2)=2$
$T(4)=2+T(2)=3$
$T(5)=2+T(3)=4$
$T(6)=3+T(3)=5$
$T(7)=3+T(4)=6$
So now we suspect that $T(n)=n-1$, and we shall prove it by induction. Proof for the base case: $T(2)=2-1=1$, as defined. Assume this property is correct for any number less than m and splits cases where m is even and m is odd. The even case: $T(2n) = \lfloor \frac {2n} {2}\rfloor + T(\lceil \frac{2n}{2} \rceil) = \lfloor n\rfloor + T(\lceil n \rceil) = n + n - 1 = 2n - 1$.
And the odd case: $T(2n+1) = \lfloor \frac {2n+1} {2}\rfloor + T(\lceil \frac{2n+1}{2} \rceil) = \lfloor n+\frac {1} {2}\rfloor + T(\lceil n+\frac{1}{2} \rceil) = n + T(n+1) = n + n = 2n$. Thus, by the principle of strong induction, $T(n)=n-1$ is true for all $n\ge2$.