Unrolling is a method for time complexity analysis for divide and conquer problems. The method is introduced in Unrolling.

Example 1

Given the sample recurrence relation:

  1. Start with the given recurrence relation
  2. Substitute the relation iteratively(the size of the subproblem is reduced by 1 each time in this example) First iteration :

Substitute the back to the original equation.

Second iteration :

Substitute the back to the original equation.

  1. Identify the pattern When , we reaches the base case . Assuming :

We can conclude that the pattern fits the arithmetic series. 4. Summing the terms We can sum up the terms using the arithmetic series rules. 5. Finalise the solution Evaluate the time complexity:

Now, we can conclude the asymptotic complexity to be:

Example 2

  1. Start with the given recurrence relation
  2. Substitute the relation iteratively(the size of the subproblem is halved each time) First iteration :

Substitute the back to the original equation:

Second iteration :

Substitute the back to the original equation:

  1. Identify the pattern

When , we reaches the base case :

Assumes The geometric series has the form: We can discover the first term common ratio , the number of terms is

  1. Summing the terms Apply the geometric series:

We known that the last term is , therefore Solve for :

Thus, the number of terms We apply the sum of geometric series formula:

  1. Evaluate the time complexity

Therefore, the time complexity of the given recurrence relation is linear, denoted as


Back to parent page: Divide and Conquer

AlgorithmDivide_and_ConquerUnrolling