# DAA : Divide and Conquer approach

In **divide and conquer approach**, a problem is divided into smaller problems, then the smaller problems are solved independently, and finally the solutions of smaller problems are combined into a solution for the large problem.

Generally, divide-and-conquer algorithms have three parts −

**Divide the problem** into a number of sub-problems that are smaller instances of the same problem.

**Conquer the sub-problems** by solving them recursively. If they are small enough, solve the sub-problems as base cases.

**Combine the solutions** to the sub-problems into the solution for the original problem.

## Pros and cons of Divide and Conquer Approach

Divide and conquer approach supports parallelism as sub-problems are independent. Hence, an algorithm, which is designed using this technique, can run on the multiprocessor system or in different machines simultaneously.

In this approach, most of the algorithms are designed using recursion, hence memory management is very high. For recursive function stack is used, where function state needs to be stored.

**Examples:** The specific computer algorithms are based on the Divide & Conquer approach:

Maximum and Minimum Problem

Binary Search

Sorting (merge sort, quick sort)

Tower of Hanoi.