I'm trying to schematize this type of exercise : Use a recursion tree to determine a good asymptotic upper bound on the recurrence $T(n) = 2T(n−2)+1$. To do this I made this table :
$$\begin{array}{c|c|} & \text{Levels} & \text{Dimension} & \text{Cost of each node at level i} & \text{Number of nodes at level i} & \text{Level cost} \\\ & 0 & n & 1 & 2^0 & 2^0 \\\ & 1 & n-2 & 1 & 2^1 & 2^1 \\\ & 2 & n-4 & 1 & 2^2 & 2^2 \\\ & . & . & . & . & . \\\ & . & . & . & . & .\\\ & i & n-(2^i-2) & 1 & 2^i & 2^i \\\ & . & . & . & . & .\\\ & . & . & . & . & .\\\ & \log_2 (1+n) & 1 & T(1) & 2^{log_2 (1+n)} = (1+n)^{log_2 (2)} = (1+n) & (1+n) \end{array}$$
Now adding the "Level cost" column up to the penultimate row and adding the last row of the table we get
$$\sum_{i=0}^{\log_2 (n)} 2^i + O(n) = \frac{2^{\log_2 (n)}-1}{2-1} + O(n) = 2^{\log_2 (n)}-1 + O(n) = O(2^{\log_2 (n)}) + O(n) = O(n) $$
Is this the right solution? $T(n) = O(n)$
This sounds strange to me, since I know that the following equation: $T(n)=2T(n−1)+1$ has this as a solution: $T(n)=O(2^n)$. I do something wrong?
Your mistake is calculating the wrong depth for the tree: the depth is not $\log_2(n+1)$. As this seems like a homework assignment, I'll give a hint instead of the direct answer:
The recurrence relation is $T(n) = 2T(n-2)+1$, i.e. we start from $n$ and then subtract 2 repeatedly until we reach one of the base cases, $T(0)$ or $T(1)$. How many times do you subtract 2 from $n$ before you reach 0 or 1? Certainly not $\log_2(n+1)$ times: you are subtracting, not dividing by two.
Once you correct the tree depth, you can calculate the closed form for $T(n)$ by correctly evaluating the sum over all the nodes.