Overview
A sorting algorithm is an algorithm that puts elements of a list
in a certain order (thus sorting the list). The most frequently
used orders are numerical order for lists of numbers and
lexicographical order for lists of strings.
To put it more formally, the output generally has to fulfill two conditions:
Sorting algorithms can generally be classified into three distinct categories:
To put it more formally, the output generally has to fulfill two conditions:
- The output is in nondecreasing order
- The output is a permutation of the input
Sorting algorithms can generally be classified into three distinct categories:
- Comparison sorts
- Non-comparison sorts
- Others
Search
A comparison sort is a type of sorting algorithm that only reads
the list elements through a single abstract comparison operation
(often a "less than or equal to" operator or a three-way
comparison) that determines which of two elements should occur
first in the final sorted list.
Non-Comparison Sorts are sorting algorithms which sort a given
input without comparing the elements, rather making certain
assumptions about the data. Examples for non-comparison sorting
algorithms are Counting sort which sorts using key-value and
Bucket Sort which examines bits of keys.
Algorithms in this category are impractical for real-life use in
traditional software contexts due to extremely poor performance
or specialized hardware requirements. These sorts are usually
described for educational purposes in order to demonstrate how
run time of algorithms is estimated.