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.
Given a relation of the form:
a = the number of subproblems in the recursion, 1/b = the portion of the original problem represented by each sub-problem f(n) = the cost of dividing the problem + the cost of merging the solution It is possible to determine an asymptotic tight bound according to these three cases:
If it is true that:
it follows that:
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³)
If it is true that:
it follows that:
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 Θ(nlog(n))
If it is true that:
and if it is also true that:
it follows that:
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²), what complies with the f(n) of the original formula.
Asymptotic analysis | Mathematical theorems | Recurrence relations
Master-Theorem | Master theorem | Master theorem dell'analisi degli algoritmi | שיטת האב
This article is licensed under the GNU Free Documentation License.
It uses material from the
"Master theorem".
Home Page • arts • business • computers • games • health • hospitals • home • kids & teens • news • physicians • recreation• reference • regional • science • shopping • society • sports • world