How to Find the Upper and Lower Bounds Using the Master Theorem

The master theorem deals with algorithms in recursive form. A recursive form algorithm has no solution that is easily obvious from algebraic manipulation. The master theorem allows you a way around this problem by comparing a recursive algorithm to other algorithms, allowing you to estimate upper and lower bounds for the solution.

Instructions

    • 1

      Write the algorithm in the form needed for the master theorem. The form is T(n) = aT(n/b) + f(n). Here, f(n) is a function of n. For example, if the algorithm you have is T(n) = e * T(n/e) + n * log(n), you can know that a = e, b = e and f(n) = n * log(n).

    • 2

      Compare f(n) to n^log(a-ep, b). Here, “ep” refers to epsilon, an arbitrarily small value and the function “log(x, y)” refers to a y-base logarithm evaluated at x. In the example, since a = b = e, compare f(n), which is n*log(n) to n^log(e-ep, e). Use your basic knowledge of functions to see that n*log(n) will always be bigger than n^log(e-ep, e), since the previous term is a product of two large numbers and the latter equates to n^(1 – ep). Thus, conclude that n*log(n) > n^log(e-ep, e).

    • 3

      Compare f(n) to n^log(a+ep, b). Notice this is similar to the previous comparison, but with the epsilon value as an added value, rather than a subtracted one. For the example, you compare f(n), which is n*log(n), to n^log(e+ep, e). Notice that this time f(n) is the smaller term, since n^log(e+ep, e) is a product of two n terms whereas f(n) is a product of one n term and one smaller log(n) term. Thus, conclude that f(n) < n^log(e+ep, e).

    • 4

      Report the upper and lower limits. Replace the f(n) part of the algorithm with the values that you just found were bigger and smaller, removing the epsilon term. In addition, replace the T(n) term with the new term corresponding to whether the limit is an upper limit or lower limit. The corresponding algorithms are the upper and lower bounds. For the example, the upper bound is then U(n) = e*U(n/e) + n*log(n) and the lower bound is L(n) = e*L(n/e) + n.

Learnify Hub © www.0685.com All Rights Reserved