In of my computer science classes, there is the following exam question:
Let an algorithm solve a problem of size $n$ by dividing it into the size $n \over 2$ in $n \over 2$ steps (division without remainder) and solve this problem recursively with the same strategy. A problem of size $1$ is solved in one step. Therefore, we have the function
$$f: \Bbb N \rightarrow \Bbb N$$
$$f(n) = {n \over 2 } + f\left({n \over 2}\right)$$
for $n > 1$ and $1$ for $n = 1$. One has to prove that $f(n) \in O(n)$.
I don't quite see how to perform the induction step here.
$$f(n+1) = {(n+1) \over 2} + f\left({n+1 \over 2}\right).$$
Now, the function has an input $n+1 \over 2$, which is a natural number by premise. But how to apply $f(n) \le n$ then?
No, $n+1$ is not a good candidate, as $(n+1)/2$ cannot be an integer. You should consider a geometric progression instead, giving
$$f(2n)=n+f(n)=n+\frac n2+f(\frac n2)$$ $$f(4n)=2n+f(2n)=2n+n+\frac n2+f(\frac n2)$$ $$...$$
or, going the other way,
$$f(n)=\frac n2+\frac n4+\frac n8+f(\frac n8)=\frac n2+\frac n4+\frac n8+\frac n{16}+f(\frac n{16})=\cdots$$