Given the algorithm
MYSTERY-ALG(n >= 0)
1 if n < 3 then
2 return 1
3 else
4 return MYSTERY-ALG(n/2) + MYSTERY-ALG((n/2) + 1)
I defined a recurrence $ T(n) = \begin{cases} 1 & 0 \leq n < 3 \\ T(\frac{n}{2}) + T(\frac{n}{2} + 1) & \text{otherwise} \end{cases} $ which I guessed to be $O(n)$; I've managed to find suitable $c$ and $n_0$, even an extra variable $b$, from which my bound holds but it fails certain base cases.
Here's my attempt:
Prove $T(n) = T(\frac{n}{2}) + T(\frac{n}{2} + 1) = O(n)$, where $T([0, 3)) = 1$.
Try 1
Assume $0 \leq ck$ for $k < n$, $c > 0$, must show $T(n) \leq cn$, $\forall n \geq n_0$.
$T(n) = T(\frac{n}{2}) + T(\frac{n}{2} + 1)$, since $\frac{n}{2} < n$ and $\frac{n}{2} + 1 < n$ for $n > 2 \implies n_0 > 2 \implies T(\frac{n}{2}) \leq \frac{cn}{2}$ and $T(\frac{n}{2} + 1) \leq \frac{cn}{2} + c \implies$
$T(n) \leq \frac{cn}{2} + \frac{cn}{2} + c = cn + c$
$\overset{?}{\leq} cn$ is not possible since $c > 0$.
Try 2
Assume $0 \leq ck - b$ for $k < n$, $c > 0$, $b > 0$ must show $T(n) \leq cn - b$, $\forall n \geq n_0$.
$T(n) = T(\frac{n}{2}) + T(\frac{n}{2} + 1)$
$\leq \frac{cn}{2} - b + \frac{cn}{2} + c - b = cn - b - b + c = cn - b - (b - c)$
$\leq cn - b$, as long as $b - c \geq 0$
$\implies b \geq c$. From here, it's not clear how to find $b$ and $c$. Strangely, this expression is also independent of $n$.
If we take $c = b = 1$, $n_0 = 3$ then the $T(3) = T(1.5) + T(2.5) = 2 \leq 3 - 1 = 2$ bound holds, but the base case, for example, $T(1) = 1 \leq 1 - 1$ fails.
Is there any way of making this work?