What makes a sorting algorithm comparison-based, and which of the familiar sorts are comparison-based?
It learns about the order of its input only by asking yes/no questions of the form "is $x_i < x_j$?" and rearranging the elements based on the answers. Bubble-, selection-, insertion-, heap-, merge- and quick-sort all work this way.
A comparison-based sort may compare two elements and move elements around, but it never looks inside a key: it does not read the key's digits, does no arithmetic with it, and does not use it as an array index. Everything it knows about the order of the input comes from the answers to its comparisons.
That restriction is what makes these algorithms generic. The only question they ever ask is "which of these two comes first?", so the same code sorts numbers, strings or whole records, ascending or descending, as long as someone supplies the comparison: a Comparator in Java, __lt__ or a key function in Python.
The restriction is also what the lower bound for sorting is about. It is proved for every algorithm that works this way, including ones nobody has invented yet. Bucket-sort and radix-sort are not in this class: they use the key itself as an array index, and that is how they get past the bound.
Go deeper:
Comparison sort โ the model, the classic members, and the limits that come with it.