1. Divide and conquer
Divide the problem into smaller independent subproblems, conquer them recursively, and combine the answers. Running time is a recurrence , where is the divide plus combine cost.
| Problem | Recurrence | Time |
|---|---|---|
| Binary search | ||
| Merge sort | ||
| Quick sort (balanced) | ||
| Fast power | multiplications | |
| Karatsuba multiplication | ||
| Strassen matrix multiplication | ||
| Closest pair of points |
Max and min together: compare elements in pairs, then the larger against the current max and the smaller against the current min. This takes comparisons, against for the naive method.
Divide and conquer suits problems whose subproblems do not overlap. If the same subproblem repeats (as in naive Fibonacci), use DP instead.