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.
The Akra–Bazzi method applies to recurrence formulas of the form:[1]
T(x)=g(x)+
k | |
\sum | |
i=1 |
aiT(bix+hi(x)) forx\geqx0.
The conditions for usage are:
ai
bi
i
ai>0
i
0<bi<1
i
\left|g'(x)\right|\inO(xc)
\left|hi(x)\right|\inO\left(
x | |
(logx)2 |
\right)
i
x0
The asymptotic behavior of
T(x)
p
k | |
\sum | |
i=1 |
ai
p | |
b | |
i |
=1
T(x)\in\Theta\left(xp\left(
x | |
1+\int | |
1 |
g(u) | |
up+1 |
du\right)\right)
(see Θ). Intuitively,
hi(x)
T
\lfloorbix\rfloor=bix+(\lfloorbix\rfloor-bix)
\lfloorbix\rfloor-bix
hi(x)
T(n)=n+T\left(
1 | |
2 |
n\right)
T(n)=n+T\left(\left\lfloor
1 | |
2 |
n\right\rfloor\right)
Suppose
T(n)
0\leqn\leq3
n2+
7 | |
4 |
T\left(\left\lfloor
1 | |
2 |
n\right\rfloor\right)+T\left(\left\lceil
3 | |
4 |
n\right\rceil\right)
n>3
p
7 | \left( | |
4 |
1 | |
2 |
\right)p+\left(
3 | |
4 |
\right)p=1
p=2
\begin{align} T(x)&\in\Theta\left(xp\left(
x | |
1+\int | |
1 |
g(u) | |
up+1 |
du\right)\right)\\ &=\Theta\left(x2\left(
x | |
1+\int | |
1 |
u2 | |
u3 |
du\right)\right)\\ &=\Theta(x2(1+lnx))\\ &=\Theta(x2logx). \end{align}
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
T(n)=T\left(\left\lfloor
1 | |
2 |
n\right\rfloor\right)+T\left(\left\lceil
1 | |
2 |
n\right\rceil\right)+n-1
for integers
n>0
\Theta(nlogn)