Sorting algorithm
Builds on AlgorithmTotal orderPermutation
Definition
Let be a totally ordered set. A sorting algorithm for is an algorithm whose inputs are finite sequences over . On each input it outputs a sequence such that:
- is a permutation of ;
- .
The algorithm is stable if moreover whenever and . It is a comparison sort if it accesses the elements only through tests of the form .
Remarks
In practice one often sorts records by a key, and is then a total preorder on records. Stability matters only in that setting, or when equal elements can be told apart.
Example: on input , the output is correct, with in one-line notation, so , , .
Non-example: an algorithm that outputs on fails clause 1, since its output is not a rearrangement of all four input elements. An algorithm that outputs its input unchanged fails clause 2 on .
Reading path
To understand this page from the ground up, read these 4 pages in order. The foundations come first.
Show the path as a graph
- no evidence level
- Algorithm concept
- Permutation concept
- Total order concept
- Sorting algorithm definition
Further reading
About this page
| Tag | B6ADA6RGAM |
|---|---|
| URI | m2://B6ADA6RGAM |
| Kind | definition |
| Writing | W0 stub |
| MSC | 68P10, 68W40 |
| Defines | Sorting algorithm |
| Uses | Algorithm, Total order, Permutation |
| Changed | 3 November 2026 |
Markdown · JSON · Edit on GitHub
What this page needs for W1
- a source with a locator (0 of 1)
The writing levels say how complete the text of a page is. They do not measure its truth.
What links here
No page links to this page yet.