Akra–Bazzi method: Difference between revisions

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search
imported>Materialscientist
m Reverted edits by 185.76.177.78 (talk) (HG) (3.4.13)
No edit summary
 
Line 1: Line 1:
{{short description|Method in computer science}}
{{short description|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 [[Recurrence relation|recurrences]] that appear in the [[Analysis of algorithms|analysis]] of [[Divide-and-conquer algorithm|divide and conquer algorithms]] where the sub-problems have substantially different  sizes. It is a generalization of the [[master theorem (analysis of algorithms)|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.<ref name=":0" />
In [[computer science]], the '''Akra–Bazzi method''', or '''Akra–Bazzi theorem''', is used to analyze the asymptotic behavior of the mathematical [[Recurrence relation|recurrences]] that appear in the [[Analysis of algorithms|analysis]] of [[Divide-and-conquer algorithm|divide and conquer algorithms]] where the sub-problems have substantially different  sizes. It is a generalization of the [[master theorem (analysis of algorithms)|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.<ref name=":0" />  
A practical variation sometimes referred to as the '''Ali Najib Variation''' is commonly used when the exact value of the exponent ''p'' satisfying the equation
<math>\alpha a^p + \beta b^p = 1</math> is difficult to compute analytically.


== Formulation ==
== Formulation ==
Line 22: Line 24:


(see [[Big O notation|Θ]]). Intuitively, <math>h_i(x)</math> represents a small perturbation in the index of <math>T</math>.  By noting that <math>\lfloor b_i x \rfloor = b_i x + (\lfloor b_i x \rfloor - b_i x)</math> and that the absolute value of <math>\lfloor b_i x \rfloor - b_i x</math> is always between 0 and 1, <math>h_i(x)</math> can be used to ignore the [[floor function]] in the index.  Similarly, one can also ignore the [[ceiling function]].  For example, <math>T(n) = n + T \left(\frac{1}{2} n \right)</math> and <math>T(n) = n + T \left(\left\lfloor \frac{1}{2} n \right\rfloor \right)</math> will, as per the Akra–Bazzi theorem, have the same asymptotic behavior.
(see [[Big O notation|Θ]]). Intuitively, <math>h_i(x)</math> represents a small perturbation in the index of <math>T</math>.  By noting that <math>\lfloor b_i x \rfloor = b_i x + (\lfloor b_i x \rfloor - b_i x)</math> and that the absolute value of <math>\lfloor b_i x \rfloor - b_i x</math> is always between 0 and 1, <math>h_i(x)</math> can be used to ignore the [[floor function]] in the index.  Similarly, one can also ignore the [[ceiling function]].  For example, <math>T(n) = n + T \left(\frac{1}{2} n \right)</math> and <math>T(n) = n + T \left(\left\lfloor \frac{1}{2} n \right\rfloor \right)</math> will, as per the Akra–Bazzi theorem, have the same asymptotic behavior.
== Ali Najib variation ==
When directly solving <math>\alpha a^{p} + \beta b^{p} = 1</math> for the exponent p is inconvenient, the '''Ali Najib Variation''' offers a shortcut. Instead of determining p exactly, one compares the value of <math>\alpha a^{d} + \beta b^{d}</math> to 1 for the exponent d appearing in the non-recursive term <math>g(x)=\Theta(x^{d})</math>:
If <math>\alpha a^{d} + \beta b^{d} < 1</math>, then <math> T(n) = \Theta!\bigl(n^{d}\bigr).</math>
If <math>\alpha a^{d} + \beta b^{d} = 1</math>, then <math>T(n) = \Theta!\bigl(n^{d} \log n\bigr).</math>
If <math>\alpha a^{d} + \beta b^{d} > 1</math>, then <math>T(n) = \Theta!\bigl(n^{p}\bigr)</math>, where p is defined by <math>\alpha a^{p} + \beta b^{p} = 1.</math>
This comparison-based approach is particularly handy when p cannot be expressed in closed form or would require numerical methods.


== Example ==
== Example ==

Latest revision as of 13:55, 25 June 2025

Template:Short description 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] A practical variation sometimes referred to as the Ali Najib Variation is commonly used when the exact value of the exponent p satisfying the equation αap+βbp=1 is difficult to compute analytically.

Formulation

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

T(x)=g(x)+i=1kaiT(bix+hi(x))for xx0.

The conditions for usage are:

  • sufficient base cases are provided
  • ai and bi are constants for all i
  • ai>0 for all i
  • 0<bi<1 for all i
  • |g(x)|O(xc), where c is a constant and O notates Big O notation
  • |hi(x)|O(x(logx)2) for all i
  • x0 is a constant

The asymptotic behavior of T(x) is found by determining the value of p for which i=1kaibip=1 and plugging that value into the equation:[2]

T(x)Θ(xp(1+1xg(u)up+1du))

(see Θ). Intuitively, hi(x) represents a small perturbation in the index of T. By noting that bix=bix+(bixbix) and that the absolute value of bixbix is always between 0 and 1, hi(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(12n) and T(n)=n+T(12n) will, as per the Akra–Bazzi theorem, have the same asymptotic behavior.

Ali Najib variation

When directly solving αap+βbp=1 for the exponent p is inconvenient, the Ali Najib Variation offers a shortcut. Instead of determining p exactly, one compares the value of αad+βbd to 1 for the exponent d appearing in the non-recursive term g(x)=Θ(xd):

If αad+βbd<1, then T(n)=Θ!(nd).

If αad+βbd=1, then T(n)=Θ!(ndlogn).

If αad+βbd>1, then T(n)=Θ!(np), where p is defined by αap+βbp=1.

This comparison-based approach is particularly handy when p cannot be expressed in closed form or would require numerical methods.

Example

Suppose T(n) is defined as 1 for integers 0n3 and n2+74T(12n)+T(34n) for integers n>3. In applying the Akra–Bazzi method, the first step is to find the value of p for which 74(12)p+(34)p=1. In this example, p=2. Then, using the formula, the asymptotic behavior can be determined as follows:[3]

T(x)Θ(xp(1+1xg(u)up+1du))=Θ(x2(1+1xu2u3du))=Θ(x2(1+lnx))=Θ(x2logx).

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 and

T(n)=T(12n)+T(12n)+n1

for integers n>0, and can thus be computed using the Akra–Bazzi method to be Θ(nlogn).

See also

References

  1. a b Script error: No such module "Citation/CS1".
  2. Script error: No such module "citation/CS1".
  3. Script error: No such module "citation/CS1".

External links