Difference between revisions of "Divide and conquer algorithm"
Karl Jones (Talk | contribs) |
Karl Jones (Talk | contribs) |
||
Line 1: | Line 1: | ||
− | In [[computer science]], '''divide and conquer''' ('''D&C''') is an [[ | + | In [[computer science]], '''divide and conquer''' ('''D&C''') is an [[algorithmic paradigm]] based on multi-branched [[recursion]]. See also [[Algorithm design]]. |
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. | 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. |
Revision as of 09:19, 30 August 2016
In computer science, divide and conquer (D&C) is an algorithmic paradigm based on multi-branched recursion. See also Algorithm design.
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.
Description
This divide and conquer technique is the basis of efficient algorithms for all kinds of problems, such as sorting (e.g., quicksort, merge sort), multiplying large numbers (e.g. the Karatsuba algorithm), finding the closest pair of points, syntactic analysis (e.g., top-down parsers), and computing the discrete Fourier transform (FFTs).
Understanding and designing D&C algorithms is a complex skill that requires a good understanding of the nature of the underlying problem to be solved. As when proving a theorem by induction, it is often necessary to replace the original problem with a more general or complicated problem in order to initialize the recursion, and there is no systematic method for finding the proper generalization. These D&C complications are seen when optimizing the calculation of a Fibonacci number with efficient double recursion.
The correctness of a divide and conquer algorithm is usually proved by mathematical induction, and its computational cost is often determined by solving recurrence relations.
See also
- Akra–Bazzi method
- Algorithm design
- Algorithmic paradigm
- Fork–join model
- Heuristic (computer science)
- Master theorem
- Mathematical induction
- MapReduce
- Sorting algorithm
External links
- Divide and conquer algorithms @ Wikipedia.org