stable sorting algorithm
If a stable sorting algorithm sorts on the second value in each pair using the relation, then the result is guaranteed to be . However, if an algorithm is not stable, then it is possible that may come before in the sorted output.
Some examples of stable sorting algorithms are bubblesort and mergesort (although the stability of mergesort is dependent upon how it is implemented). Some examples of unstable sorting algorithms are heapsort and quicksort (quicksort could be made stable, but then it wouldn’t be quick any more). Stability is a useful property when the total ordering relation is dependent upon initial position. Using a stable sorting algorithm means that sorting by ascending position for equal keys is built-in, and need not be implemented explicitly in the comparison operator.
|Title||stable sorting algorithm|
|Date of creation||2013-03-22 12:31:04|
|Last modified on||2013-03-22 12:31:04|
|Last modified by||mathcam (2727)|
|Defines||unstable sorting algorithm|