# 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

**1998**. The Akra-Bazzi method can be applied to the recurrences of the following form:

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

- a
_{1 }= 3- b
_{1 }=- a
_{2 }= 2- b
_{2 }=- b
_{1}and b_{2}are in the range (0, 1)- g(n) = \theta(n) which is O(n
^{c}), here c can be 1.

In this problem h_{1}(n) and h_{2}(n) are not present.

Here p=1 satisfies

Finally,

=>

=>

=>

=>

**Example 2.**

Here

- a =
- b =
- g(n) =
- b is in the range (0, 1)
- g(n) = \theta(n^2) which is in O(n
^{c}), here c can be 1.

In this problem h(n) is not present.

Here p= – 1 satisfies

Finally,

=>

=>

=>

=>

=>

**Example 3.**

Here

- a = 9
- b =
- g(n) = \theta(n)
- b is in the range(0, 1)
- g(n) = which is O(n
^{c}), here c can be 1.- h(n) = which is

Here p=2 satisfies

Finally,

=>

=>

=>

=>

=>

=>

**Advantages:**

- Works for many divides and conquer algorithms.
- Has a lesser constraint over the format of the recurrence than Master’s Theorem.
- p can be calculated using numerical methods for complex recurrence relations.

**Disadvantages:**

- Does not work when the growth of g(n) is not bounded polynomial. For Example
**g(N) = 2**.^{N} - Does not deal with ceil and floor functions.

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the **DSA Self Paced Course** at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer **Complete Interview Preparation Course****.**

In case you wish to attend **live classes **with experts, please refer **DSA Live Classes for Working Professionals **and **Competitive Programming Live for Students**.