What is the master theorem? What is its importance in analyzing algorithm complexity?
What is the master theorem? What is its importance in analyzing algorithm complexity?
The structure of many efficient algorithms follows the paradigm of division and conquest. This paradigm (or algorithm design strategy) consists of the following:
It is a mathematical technique that allows to define sequences, sets, operations or even algorithms starting from particular problems for generic problems. That is, by means of a rule one can calculate any term according to the immediate predecessor (s).
Many of the recurrences that occur in parsing division and conquest algorithms have the form:
F(n) = a F(n/2) + cn^k
The following Master Theorem gives the solution (in asymptotic terms) of all these recurrences.
Theorem: Let a nonzero natural number, k be a natural number, and c is a positive real number. Let F be a function that takes natural numbers into positive real numbers and satisfies the recurrence (*) for n = 21, 22, 23, ... Suppose that F is asymptotically non-decreasing, ie that there exists n1 such that F (n) ≤ F (n + 1) for all n ≥ n1. Under these conditions,
- if lg a > k then F is in Θ (n ^ lg a),
- if lg a = k then F is in Θ (n ^ k lg n),
- if lg a < k then F is in Θ (n ^ k).
F(n) = a F(n/b) + cn^k.
The Master Theorem allows you a way around this problem by comparing a recursive algorithm with other algorithms, which allows you to estimate the upper and lower bounds for the solution.
In other words, Master Theorem calculates the resources required to run a recursive algorithm, such as runtime on a computer. The master method uses what is known as Big O notation to describe the asymptotic behavior of functions, that is, how quickly they grow toward their limit.
Search sources: