In computer sciencedivide and conquer is an algorithm design paradigm based on multi-branched recursion. A divide-and-conquer algorithm works by recursively breaking down a problem into two or more sub-problems of the same or related type, until these become simple enough to be solved directly. The solutions to the sub-problems are then combined to give a solution to the original problem.

This divide-and-conquer technique is the basis of efficient algorithms for all kinds of problems, such as sorting (e.g., quicksortmerge sort), multiplying large numbers (e.g. the Karatsuba algorithm), finding the closest pair of pointssyntactic analysis (e.g., top-down parsers), and computing the discrete Fourier transform (FFT).

Divide-and-conquer approach to sort the list (38, 27, 43, 3, 9, 82, 10) in increasing order. Upper half:splitting into sublists; mid: a one-element list is trivially sorted; lower half: composing sorted sublists.

Algorithm efficiency

The divide-and-conquer paradigm often helps in the discovery of efficient algorithms. It was the key, for example, to Karatsuba's fast multiplication method, the quicksort and mergesort algorithms, the Strassen algorithm for matrix multiplication, and fast Fourier transforms.

In all these examples, the D&C approach led to an improvement in the asymptotic cost of the solution. For example, if (a) the base cases have constant-bounded size, the work of splitting the problem and combining the partial solutions is proportional to the problem's size n, and (b) there is a bounded number p of subproblems of size ~ n/p at each stage, then the cost of the divide-and-conquer algorithm will be O(n logpn).

You have no rights to post comments