Consider:

\begin{equation} T\left(n\right) = 2 T\left(\frac{n}{2}\right) + n \end{equation}

We can get the recurrence relation. guess the answer We can try to expand the middle by plugging stuff in: T\left(n\right) = 2T\left(\frac{n}{2}\right) +n T\left(n\right) = 2\left(2 T\left(\frac{n}{4}\right)+ \frac{n}{2}\right) + n T\left(n\right) = 4T\left(\frac{n}{4}\right) + 2n … We can guess the pattern by staring at it: T\left(n\right) = 2^{j} T\left(\frac{n}{2^{j}}\right) + j\cdot n is true for all j. Suppose j= \log \left(n\right) (that’s where T\left(n\right) disappears), T\left(n\right) = n\left(\log \left(n\right) + 1\right). prove the guess is correct inductive hypothesis: T\left(n\right) = n\left( \log\left(n\right) + 1\right) base case: T\left(1\right) given to you inductive step: use strong induction as n get smaller and then finally state you guess. example Consider the following fun recurrence relation:

\begin{equation} T\left(n\right) \leq T\left(\frac{n}{5}\right) + T\left(\frac{7n}{10}\right) + n, n > 10 \end{equation}

base case where T\left(n\right)=1, when 1 \leq n \leq 10. Let’s try to use the substitution method to solve this. Guess By divine guess we guess O\left(n\right). Induction Recall that our inductive hypothesis cannot be T\left(n\right)=O\left(n\right), because we will have extra quantifiers for all n instead of a specific n. Our inductive hypothesis has therefore be more specific, namely: Inductive hypothesis:

\begin{equation} T\left(n\right) \leq Cn \end{equation}

Base case: 1 = T\left(n\right) \leq Cn for all 1 \leq n \leq 10 as per given. Inductive step: For k > 10, assume that IH holds (strong) for all n such that 1 \leq n < k.

\begin{align} T\left(k\right) &\leq K + T\left(\frac{k}{5}\right) + T\left(\frac{7k}{10}\right) \\ &\leq k + C\left(\frac{k}{5}\right) + C\left(\frac{7k}{10}\right) \\ &= k + \frac{C}{5}k + \frac{7C}{10} k \end{align}

So we desire C such that:

\begin{equation} k + \frac{C}{5}k + \frac{7C}{10} k \leq Ck \end{equation}

solving for C, we note that:

\begin{equation} 1 \leq \frac{C}{10} \end{equation}

will hold for this equation. Conclusion so there is some C=10 such that for all n \geq 1, T\left(n\right)\leq Cn.

[[curator]]
I'm the Curator. I can help you navigate, organize, and curate this wiki. What would you like to do?