How do I solve the following recurrence?
$$T(n) = 2T(n-2) + 4$$
I've looked online and there are only examples for how to do it without the constant at the end, and I've tried leaving it in to get a characteristic equation of $r^2 = 6$ but that didn't work either.
Also, how would I solve something like the following,
$$T(n) = T(n / 2) + c$$
where $c$ is some arbitrary constant? Note that the second one is easy to solve by inspection, but i wanted to know if there is a systematic way.
$$T(n)=2T(n-2)+4\\ =2(2T(n-4)+4)+4=2^2T(n-4)+(2+1)4\\ =2^2(2T(n-6)+4)+(2+1)4=2^3T(n-6)+(2^2+2+1)4\\ =2^3(2T(n-8)+4)+(2^2+2+1)4=2^4T(n-8)+(2^3+2^2+2+1)4\\ \vdots\\ =2^{n/2}T(n-n)+(2^{n/2}-1)4.$$
Let $n=2^k$.
Then $$T(2^k)=T(2^{k-1})+c=T(2^{k-2})+2c=\cdots T(2^{k-k})+kc.$$