A general recurrence relation solution formula. It’s a generalization of the “tree” method in example 1. intuition Every Recursion Theorem problem has a struggle between most work sitting at the “bottom” of the tree (number of subproblems explode, a &gt; b^{d}) vs most work sitting at the “top” of the tree (problem lower in the tree are smaller, a &lt; b^{d}). constituents Consider: a: number of subproblems b: input size shrink d need to do n^{d} work to merge subproblems Suppose a \geq 1, b&gt; 1, and d are constants. Suppose T\left(n\right) = aT\left(\frac{n}{b}\right) + O\left(n^{d}\right), we then have: requirements \begin{equation} T\left(n\right) = \begin{cases} O\left(n^{d}\log\left(n\right)\right), \text{ if } a = b^{d}\ O\left(n^{d}\right), \text{ if } a < b^{d}\ O\left(n^{\log_{b} \left(a\right)}\right), \text{ if } a > b^{d}\ \end{cases} \end{equation} additional information proof Suppose that T\left(n\right) \leq a\cdot T\left(\frac{n}{b}\right) + c \cdot n^{d}. We desire the master theorem’s statement. Consider a standard tree argument via merge sort. At each layer, the input size gets cut by b, so we obtain \log_{b} \left(n\right) layers of the tree. Filling things out we get the following table: Adding up the work of this table:

\begin{align} \sum_{t=0}^{\log_{b}n} a^{t} c \left(\frac{n}{b^{t}}\right)^{d} &amp;= cn^{d}\sum_{t=0}^{\log_{b}n} a^{t}\left(\frac{1}{b^{t}}\right)^{d} \\ &amp;= cn^{d}\sum_{t=0}^{\log_{b}\left(n\right)} \left(\frac{a}{b^{d}}\right)^{t} \end{align}

The master theorem therefore splits equation into three components based on the ratio \frac{a}{b^{d}}: a = b^{d} So we obtain:

\begin{align} c n^{d} \sum_{t=0}^{\log _{b}\left(n\right)} 1 = c n^{d} \left(\log_{b}\left(n\right)+1\right) = \theta\left(n^{d}\log\left(n\right)\right) \end{align}

a &lt; b^{d} Recall bounded geometric sum. Notice that if a &lt; b^{t}, then \left(\frac{a}{b^{d}}\right)^{t} should be x^{t}, x&lt; 1, so its bounded by a constant. Hence:

\begin{align} c n^{d} \sum_{t=0}^{\log _{b}\left(n\right)} \left(\frac{a}{b^{d}}\right)^{t} = cn^{d}\theta\left(1\right) = \theta \left(n^{d}\right) \end{align}

a &gt; b^{d} by bounded geometric sum

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