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.

Level: intermediateTopic: Data structures algorithms

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

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.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.