|
In the analysis of algorithms, the master theorem, which is a specific case of the Akra-Bazzi theorem, provides a cookbook solution in asymptotic terms for recurrence relations of types that occur in practice. It was popularized by the canonical algorithms textbook Introduction to Algorithms by Cormen, Leiserson, Rivest, and Stein, which introduces and proves it in sections 4.3 and 4.4, respectively. Nevertheless, not all recurrence relations can be solved with the use of the master theorem. To analyze an algorithm is to determine the amount of resources (such as time and storage) necessary to execute it. ...
In computer science, the Akra-Bazzi method, or Akra-Bazzi theorem, is used to analyze the asymptotic behavior of the mathematical recurrences that appear in the analysis of divide and conquer algorithms where the sub-problems have substantially different sizes. ...
In mathematics and applications, particularly the analysis of algorithms, asymptotic analysis is a method of classifying limiting behaviour, by concentrating on some trend. ...
In mathematics, a recurrence relation, also known as a difference equation, is an equation which defines a sequence recursively: each term of the sequence is defined as a function of the preceding terms. ...
Cover of the second edition Introduction to Algorithms is a book by Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, and Clifford Stein. ...
Thomas H. Cormen is the co-author of Introduction to Algorithms, along with Charles Leiserson, Ron Rivest, and Cliff Stein. ...
Charles E. Leiserson is a computer scientist, specializing in the theory of parallel computing and distributed computing, and particularly practical applications thereof; as part of this effort, he developed the Cilk multithreaded language. ...
Election People This box: Professor Ronald Lorin Rivest (born 1947, Schenectady, New York) is a cryptographer, and is the Andrew and Erna Viterbi Professor of Computer Science at MITs Department of Electrical Engineering and Computer Science (CSAIL). ...
Clifford Stein is a computer scientist, currently working as a professor at Columbia University in New York, NY. He earned his BSE from Princeton University in 1987, a MS from Massachusetts Institute of Technology in 1989, and a PhD from Massachusetts Institute of Technology in 1992. ...
Generic form
The master theorem concerns recurrence relations of the form:  In the application to the analysis of a recursive algorithm, the constants and function take on the following significance: - n is the size of the problem.
- a is the number of subproblems in the recursion.
- n/b is the size of each subproblem. (Here it is assumed that all subproblems are essentially the same size.)
- f (n) is the cost of the work done outside the recursive calls, which includes the cost of dividing the problem and the cost of merging the solutions to the subproblems.
It is possible to determine an asymptotic tight bound in these three cases:
Case 1 Generic form If it is true that: for some constant ε > 0 it follows that:  Example  As you can see in the formula above, the variables get the following values: , , ,  Now you have to check that the following equation holds:  If you insert the values from above, you get:  If you choose ε = 1, you get:  Since this equation holds, the first case of the master theorem applies to the given recurrence relation, thus resulting in the conclusion:  If you insert the values from above, you finally get:  Thus the given recurrence relation T(n) was in Θ(n³)
Case 2 Generic form If it is true that: for some  it follows that:  Example  As you can see in the formula above the variables get the following values: , , , ,  Now you have to check that the following equation holds:  If you insert the values from above, you get:  Since this equation holds, the second case of the master theorem applies to the given recurrence relation, thus resulting in the conclusion:  If you insert the values from above, you finally get:  Thus the given recurrence relation T(n) was in Θ(n log n).
Case 3 Generic form If it is true that: for some constant ε > 0 and if it is also true that: for some constant c < 1 and sufficiently large n it follows that:  Example  As you can see in the formula above the variables get the following values: , , ,  Now you have to check that the following equation holds:  If you insert the values from above, and choose ε = 1, you get:  Since this equation holds, you have to check the second condition, namely if it is true that:  If you insert once more the values from above, you get:   If you choose , it is true that:  So it follows:  If you insert once more the necessary values, you get:  Thus the given recurrence relation T(n) was in Θ(n²), that complies with the f (n) of the original formula.
See also For other uses, see Big O. In computational complexity theory, big O notation is often used to describe how the size of the input data affects an algorithms usage of computational resources (usually running time or memory). ...
References Thomas H. Cormen is the co-author of Introduction to Algorithms, along with Charles Leiserson, Ron Rivest, and Cliff Stein. ...
Charles E. Leiserson is a computer scientist, specializing in the theory of parallel computing and distributed computing, and particularly practical applications thereof; as part of this effort, he developed the Cilk multithreaded language. ...
Professor Ron Rivest Professor Ronald Linn Rivest (born 1947, Schenectady, New York) is a cryptographer, and is the Viterbi Professor of Computer Science at MITs Department of Electrical Engineering and Computer Science. ...
Clifford Stein is a computer scientist, currently working as a professor at Columbia University in New York, NY. He earned his BSE from Princeton University in 1987, a MS from Massachusetts Institute of Technology in 1989, and a PhD from Massachusetts Institute of Technology in 1992. ...
Cover of the second edition Introduction to Algorithms is a book by Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, and Clifford Stein. ...
External Links - Stony Brook CS Dept Notes for an explanation of why the Master Theorem works
|