Master Method

Document last modified: 

Use the Master Method to asymptotically bound T(n)

  • T(n) = a * T(n/b) + f(n)                  where n/b replaces either ⌊n/b⌋ or ⌈n/b⌉
  • a ≥ 1 the number of subproblems
  • b > 1
  • f(n) = D(n)+C(n) is a function describing the cost of dividing and combining

T(n) can be asymptotically bounded for 3 cases as follows:

  1. f(n) < nlogba                Intuitively: cost is dominated by leaves.

    If f(n) = O(nlogba - ε ) for some constant ε > 0 then T(n) ∈ Θ (nlogba)

  2. f(n) = nlogba

    If f(n) = Θ(nlogba ) then T(n) ∈ Θ(nlogba * lg n)

  3. f(n) > nlogba           Intuitively: cost is dominated by root.

    If f(n) = Ω(nlogba +ε ) for some constant ε > 0 and

    af(n/b) ≤ cf(n) for some constant c < 1 and all sufficiently large n

    then T(n) ∈ Θ(f(n))

    i.e. f(n) is polynomially greater than nlogba

 

  1. T(n) = 5T(n/2) + Θ(n2)

    log2 5 ≈ 2.32
     

  2. T(n) = 2T(n/2) + n
     

  3. T(n) = 5T(n/2) + Θ(n3)

log2 5 ≈ 2.32