I have to solve the recurrence relation
$$T(n)=\left\{\begin{matrix} 3T\left (\frac{n}{4} \right)+n & , n>1\\ 1 &, n=1 \end{matrix}\right.$$
and prove by induction that the solution I found is right.
I found that the solution of the recurrence relation is $T(n)=O(n)$.
I started proving it like that:
- $n=1: T(1)=1 \leq c \cdot 1 \checkmark \text{ for } c \geq 1$
- We suppose that for any $m$, $2 \leq m <n , n>2$: $T(m) \leq c \cdot m$.
- We want to show that the claim stands for $n$.
But, then I noticed that we do not have a formula for $T \left ( \frac{n}{4} \right)$ when $n<4$ and also when $n \neq 4^k$.
So, do we have to suppose that $n \geq 4$ and $n=4^k$ ?
If so, at which point of the proof, do I have to claim it?
I found $T(n)=4n-3n^{\log_4 3}$..
– evinda Oct 07 '14 at 16:35The recursive relation $T(n)=3 T \left ( \frac{n}{n}\right )+n$ is only defined for $n=4^{k},k \geq 0$ , so: $$T(n)=3 T \left ( \frac{n}{4}\right )+n \Rightarrow T(4^k)=3T (4^{k-1})+4^k$$
$$k=0: n=1: T(1)=1 \leq c \cdot 1 \text{ if } c \geq 1 $$ We suppose that $ T(4^{k-1}) \leq c \cdot 4^{k-1} $.
$$ T(4^k)=3T(4^{k-1})+4^k \leq c \cdot 4^k \text{ if } c \geq 4 $$
Could you tell me if it is right?
– evinda Oct 07 '14 at 20:08