Hybrid algorithm

This is generally done to combine desired features of each, so that the overall algorithm is better than the individual components.

Merge sort and quicksort are asymptotically optimal on large data, but the overhead becomes significant if applying them to small data, hence the use of a different algorithm at the end of the recursion.

This is useful for efficiency when the algorithm usually encounters the base case many times, as in many tree algorithms, but is otherwise considered poor style, particularly in academia, due to the added complexity.

Introsort begins with a quicksort, but switches to a heap sort if quicksort is not progressing well; analogously introselect begins with quickselect, but switches to median of medians if quickselect is not progressing well.

For example, in models such as MapReduce, the Map and Reduce step solve different problems, and are combined to solve a different, third problem.