This algorithm is sometimes implemented with a switch to a heap-based approach at a sufficiently deep level of recursion.
This algorithm is sometimes implemented with a switch to a heap-based approach at a sufficiently deep level of recursion. This solves the problem that when operating on an array that is already in order, this algorithm degenerates to n squared running time. It works by sorting elements based on whether they are greater or less than a selected pivot and then recurring for each of those halves. For 10 points, give this O(n log n) [big-oh of n log n] sorting algorithm named for its rapidity.
This algorithm is sometimes implemented with a switch to a heap-based approach at a sufficiently deep level of recursion.
quicksort