In 1964, Goetz attended a conference on software intellectual property issues.He subsequently decided that an improved data sorting algorithm he had developed was patentable.Data sorting was an important issue for the mainframe computers of the day, many of which used magnetic tape for storage.…

The name comes by analogy with the Dutch national flag problem in the last step: efficiently partition the array into many "stripes".Sorting algorithms in general sort a list of objects according to some ordering scheme.In contrast to comparison-based sorting algorithms, such as quicksort, American flag sort can only sort integers (or objects that can be interpreted as integers).…

Therefore, bubble sort is not a practical sorting algorithm when n is large.The only significant advantage that bubble sort has over most other implementations, even quicksort, but not insertion sort, is that the ability to detect that the list is sorted is efficiently built into the algorithm.…

According to D. Aldous and P. Diaconis, patience sorting was first recognized as an algorithm to compute the longest increasing subsequence length by Hammersley, and by A.S.C. Ross and independently Bazaar version control system uses the patience sorting algorithm for merge resolution.The patience sorting algorithm can also be applied to process control.Within a series of measurements, the existence of a long increasing subsequence can be used as a trend marker.…

A sorting algorithm falls into the adaptive sort family if it takes advantage of existing order in its input.It benefits from the presortedness in the input sequence - or a limited amount of disorder for various definitions of measures of disorder - and sorts faster.…

A collation algorithm such as the Unicode collation algorithm defines an order through the process of comparing two given character strings and deciding which should come before the other.When an order has been defined in this way, a sorting algorithm can be used to put a list of any number of items into that order.The main advantage of collation is that it makes it fast and easy for a user to find an element in the list, or to confirm that it is absent from the list.…

When attempting to sort in a non-standard way it may be easier to contain the comparison logic as an anonymous function instead of creating a named function.Most languages provide a generic sort function that implements a sort algorithm that will sort arbitrary objects.This function usually accepts an arbitrary comparison function that is supplied two items and the function indicates if they are equal or if one is "greater" or "less" than the other (typically indicated by returning a negative number, zero, or a positive number).…

In computer science, selection sort is a sorting algorithm, specifically an in-place comparison sort.

Bucket sort is a generalization of pigeonhole sort.Bucket sort can be implemented with comparisons and therefore can also be considered a comparison sort algorithm.The computational complexity estimates involve the number of buckets.…

Remembering this order, however, may require additional time and space.One application for stable sorting algorithms is sorting a list using a primary and secondary key.…

Radix sort, such as two pass method where counting sort is used during the first pass of each level of recursion, has a large constant overhead.Thus, when the bins get small, other sorting algorithms should be used, such as insertion sort.A good implementation of Insertion sort is fast for small arrays, stable, in-place, and can significantly speed up Radix Sort.…

The use of scratch space simplifies the partitioning step, but increases the algorithm's memory footprint and constant overheads.Other more sophisticated parallel sorting algorithms can achieve even better time bounds.For example, in 1991 David Powers described a parallelized quicksort (and a related radix sort) that can operate in time on a CRCW PRAM with processors by performing partitioning implicitly.…

A 2008 re-evaluation of this algorithm showed it to be no faster than ordinary heapsort, though, presumably because modern branch prediction nullifies the cost of the comparisons that bottom-up heapsort manages to avoid.Heapsort primarily competes with quicksort, another very efficient general purpose nearly-in-place comparison-based sort algorithm.…

Other sophisticated parallel sorting algorithms can achieve the same or better time bounds with a lower constant.

Given a list of distinct numbers (we can assume this because this is a worst-case analysis), there are n factorial permutations exactly one of which is the list in sorted order.The sort algorithm must gain enough information from the comparisons to identify the correct permutation.…

Note that from a computational-complexity standpoint, priority queues are congruent to sorting algorithms.See the next section for how efficient sorting algorithms can create efficient priority queues.There are several specialized heap data structures that either supply additional operations or outperform heap-based implementations for specific types of keys, specifically integer keys.…

Experimental results such as those of Astrachan have also shown that insertion sort performs considerably better even on random lists.For these reasons many modern algorithm textbooks avoid using the bubble sort algorithm in favor of insertion sort.Bubble sort also interacts poorly with modern CPU hardware.…

They often arise when different orderings on certain finite sets are considered, possibly only because one wants to ignore such orderings and needs to know how many configurations are thus identified.For similar reasons permutations arise in the study of sorting algorithms in computer science.The number of permutations of n distinct objects is n factorial usually written as, which means the product of all positive integers less than or equal to n.…

A quantum sort is any sorting algorithm that runs on a quantum computer.

Many of them are based on the assumption that the key size is large enough that all entries have unique key values, and hence that, where << means "much less than."The following table describes some sorting algorithms that are impractical for real-life use due to extremely poor performance or specialized hardware requirements.…