Master theorem: Difference between revisions
Jump to navigation
Jump to search
Line 1: | Line 1: | ||
== MASTER THEOREM == | == MASTER THEOREM == | ||
Let a | Let <math>a \ge; 1</math> and <math>b > 1</math> be constants, let <math>f(n)</math> be a function, and let <math>T(n)</math> be defined on the nonnegative integers by the recurrence | ||
<math>T(n) = aT(n/b) + f(n)</math>, | |||
where we interpret | where we interpret <math>n/b</math> to mean either <math> \lfloor n/b \rfloor or \lceil n/b \rceil </math>. Then <math>T(n)</math> can be bounded asymptotically as follows. | ||
#If <math>f(n) = O(n^{\log_b b a - \epsilon})</math> for some constant <math>\epsilon > 0</math>, then <math>T(n) = \Theta(n^{\log_b a})</math>. | |||
#If <math>f(n) = \Theta(n^{\log_b a})</math>, then <math>T(n) = \Theta(n^{\log_b a} \lg n)</math>. <br> | |||
#If <math>f(n) = \Omega(n^{\log_b a + \epsilon})</math> for some constant <math>\epsilon > 0</math>, and if <math>af(n/b) \le cf(n)</math> for some constant <math>c < 1</math> and all sufficiently large <math>n</math>, then <math>T(n) = \Omega(f(n))</math>. |
Revision as of 23:21, 18 October 2014
MASTER THEOREM
Let [math]\displaystyle{ a \ge; 1 }[/math] and [math]\displaystyle{ b \gt 1 }[/math] be constants, let [math]\displaystyle{ f(n) }[/math] be a function, and let [math]\displaystyle{ T(n) }[/math] be defined on the nonnegative integers by the recurrence
[math]\displaystyle{ T(n) = aT(n/b) + f(n) }[/math],
where we interpret [math]\displaystyle{ n/b }[/math] to mean either [math]\displaystyle{ \lfloor n/b \rfloor or \lceil n/b \rceil }[/math]. Then [math]\displaystyle{ T(n) }[/math] can be bounded asymptotically as follows.
- If [math]\displaystyle{ f(n) = O(n^{\log_b b a - \epsilon}) }[/math] for some constant [math]\displaystyle{ \epsilon \gt 0 }[/math], then [math]\displaystyle{ T(n) = \Theta(n^{\log_b a}) }[/math].
- If [math]\displaystyle{ f(n) = \Theta(n^{\log_b a}) }[/math], then [math]\displaystyle{ T(n) = \Theta(n^{\log_b a} \lg n) }[/math].
- If [math]\displaystyle{ f(n) = \Omega(n^{\log_b a + \epsilon}) }[/math] for some constant [math]\displaystyle{ \epsilon \gt 0 }[/math], and if [math]\displaystyle{ af(n/b) \le cf(n) }[/math] for some constant [math]\displaystyle{ c \lt 1 }[/math] and all sufficiently large [math]\displaystyle{ n }[/math], then [math]\displaystyle{ T(n) = \Omega(f(n)) }[/math].