AI engineering glossary · Data structures algorithms
What is comparison sort?
Comparison sort: A sorting method that orders items only by comparing pairs of them. Any such method needs at least about n log n comparisons in the worst case, which is why merge sort and heap sort are considered optimal among these.
Comparison sort: an example
Sorting 1,024 names by pairwise comparisons needs at least about 1,024 * 10 comparisons in the worst case.
Related terms
More Data structures algorithms terms
- Connected components
- Consistent hashing
- Counting sort
- Cycle detection
- Data structure
- Depth-first search
- Deque
- Dijkstra's algorithm
Where you learn it
Comparison sort is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.