Open In App

Akra-Bazzi method for finding the time complexities

Master’s theorem is a popular method to solve time complexity recurrences of the form:



With constraints over a, b and f(n). The recurrence relation form limits the usability of the Master’s theorem. Following are three recurrences that cannot be solved directly using master’s theorem:


Akra-Bazzi Method: This article explores another method for solving such recurrences that were developed by Mohammad Akra and Louay Bazzi in 1992. 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.



 where,   and  are constants such that:

Next, find p such that


 

Then

Examples
Let’s consider the three recurrences discussed above and solve them using the method:

Example 1. 

 

Here 

  1. a1 = 3
  2. b1
  3. a2 = 2
  4. b2
  5. b1 and b2 are in the range (0, 1)
  6. g(n) = \theta(n) which is O(nc), here c can be 1.

In this problem h1(n) and h2(n) are not present.
Here p=1 satisfies

 Finally,

=> 

=> 

=>

=>

Example 2.  

Here

  1. a = 
  2. b = 
  3. g(n) = 
  4. b is in the range (0, 1)
  5. g(n) = \theta(n^2) which is in O(nc), here c can be 1.

In this problem h(n) is not present.
Here p= – 1 satisfies

Finally,  

=> 

=> 

=> 

=> 

=> 

=> 

Example 3.

 

Here 

  1. a = 9
  2. b = 
  3. g(n) = \theta(n)
  4. b is in the range(0, 1)
  5. g(n) =  which is O(nc), here c can be 1.
  6. h(n) =   which is 

Here p=2 satisfies 

Finally,

=> 

=> 

=> 

=> 

=> 

=> 

Advantages:

Disadvantages:


Article Tags :