Akra–Bazzi method

Method in computer science

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. It is a generalization of the master theorem for divide-and-conquer recurrences, which assumes that the sub-problems have equal size. It is named after mathematicians Mohamad Akra and Louay Bazzi.[1]

Formulation

The Akra–Bazzi method applies to recurrence formulas of the form:[1]

T ( x ) = g ( x ) + i = 1 k a i T ( b i x + h i ( x ) ) for  x x 0 . {\displaystyle T(x)=g(x)+\sum _{i=1}^{k}a_{i}T(b_{i}x+h_{i}(x))\qquad {\text{for }}x\geq x_{0}.}

The conditions for usage are:

  • sufficient base cases are provided
  • a i {\displaystyle a_{i}} and b i {\displaystyle b_{i}} are constants for all i {\displaystyle i}
  • a i > 0 {\displaystyle a_{i}>0} for all i {\displaystyle i}
  • 0 < b i < 1 {\displaystyle 0<b_{i}<1} for all i {\displaystyle i}
  • | g ( x ) | O ( x c ) {\displaystyle \left|g'(x)\right|\in O(x^{c})} , where c is a constant and O notates Big O notation
  • | h i ( x ) | O ( x ( log x ) 2 ) {\displaystyle \left|h_{i}(x)\right|\in O\left({\frac {x}{(\log x)^{2}}}\right)} for all i {\displaystyle i}
  • x 0 {\displaystyle x_{0}} is a constant

The asymptotic behavior of T ( x ) {\displaystyle T(x)} is found by determining the value of p {\displaystyle p} for which i = 1 k a i b i p = 1 {\displaystyle \sum _{i=1}^{k}a_{i}b_{i}^{p}=1} and plugging that value into the equation:[2]

T ( x ) Θ ( x p ( 1 + 1 x g ( u ) u p + 1 d u ) ) {\displaystyle T(x)\in \Theta \left(x^{p}\left(1+\int _{1}^{x}{\frac {g(u)}{u^{p+1}}}du\right)\right)}

(see Θ). Intuitively, h i ( x ) {\displaystyle h_{i}(x)} represents a small perturbation in the index of T {\displaystyle T} . By noting that b i x = b i x + ( b i x b i x ) {\displaystyle \lfloor b_{i}x\rfloor =b_{i}x+(\lfloor b_{i}x\rfloor -b_{i}x)} and that the absolute value of b i x b i x {\displaystyle \lfloor b_{i}x\rfloor -b_{i}x} is always between 0 and 1, h i ( x ) {\displaystyle h_{i}(x)} can be used to ignore the floor function in the index. Similarly, one can also ignore the ceiling function. For example, T ( n ) = n + T ( 1 2 n ) {\displaystyle T(n)=n+T\left({\frac {1}{2}}n\right)} and T ( n ) = n + T ( 1 2 n ) {\displaystyle T(n)=n+T\left(\left\lfloor {\frac {1}{2}}n\right\rfloor \right)} will, as per the Akra–Bazzi theorem, have the same asymptotic behavior.

Example

Suppose T ( n ) {\displaystyle T(n)} is defined as 1 for integers 0 n 3 {\displaystyle 0\leq n\leq 3} and n 2 + 7 4 T ( 1 2 n ) + T ( 3 4 n ) {\displaystyle n^{2}+{\frac {7}{4}}T\left(\left\lfloor {\frac {1}{2}}n\right\rfloor \right)+T\left(\left\lceil {\frac {3}{4}}n\right\rceil \right)} for integers n > 3 {\displaystyle n>3} . In applying the Akra–Bazzi method, the first step is to find the value of p {\displaystyle p} for which 7 4 ( 1 2 ) p + ( 3 4 ) p = 1 {\displaystyle {\frac {7}{4}}\left({\frac {1}{2}}\right)^{p}+\left({\frac {3}{4}}\right)^{p}=1} . In this example, p = 2 {\displaystyle p=2} . Then, using the formula, the asymptotic behavior can be determined as follows:[3]

T ( x ) Θ ( x p ( 1 + 1 x g ( u ) u p + 1 d u ) ) = Θ ( x 2 ( 1 + 1 x u 2 u 3 d u ) ) = Θ ( x 2 ( 1 + ln x ) ) = Θ ( x 2 log x ) . {\displaystyle {\begin{aligned}T(x)&\in \Theta \left(x^{p}\left(1+\int _{1}^{x}{\frac {g(u)}{u^{p+1}}}\,du\right)\right)\\&=\Theta \left(x^{2}\left(1+\int _{1}^{x}{\frac {u^{2}}{u^{3}}}\,du\right)\right)\\&=\Theta (x^{2}(1+\ln x))\\&=\Theta (x^{2}\log x).\end{aligned}}}

Significance

The Akra–Bazzi method is more useful than most other techniques for determining asymptotic behavior because it covers such a wide variety of cases. Its primary application is the approximation of the running time of many divide-and-conquer algorithms. For example, in the merge sort, the number of comparisons required in the worst case, which is roughly proportional to its runtime, is given recursively as T ( 1 ) = 0 {\displaystyle T(1)=0} and

T ( n ) = T ( 1 2 n ) + T ( 1 2 n ) + n 1 {\displaystyle T(n)=T\left(\left\lfloor {\frac {1}{2}}n\right\rfloor \right)+T\left(\left\lceil {\frac {1}{2}}n\right\rceil \right)+n-1}

for integers n > 0 {\displaystyle n>0} , and can thus be computed using the Akra–Bazzi method to be Θ ( n log n ) {\displaystyle \Theta (n\log n)} .

See also

  • Master theorem (analysis of algorithms)
  • Asymptotic complexity

References

  1. ^ a b Akra, Mohamad; Bazzi, Louay (May 1998). "On the solution of linear recurrence equations". Computational Optimization and Applications. 10 (2): 195–210. doi:10.1023/A:1018373005182. S2CID 7110614.
  2. ^ "Proof and application on few examples" (PDF).
  3. ^ Cormen, Thomas; Leiserson, Charles; Rivest, Ronald; Stein, Clifford (2009). Introduction to Algorithms. MIT Press. ISBN 978-0262033848.

External links

  • O Método de Akra-Bazzi na Resolução de Equações de Recorrência (in Portuguese)