AI engineering glossary · Data structures algorithms

What is selection sort?

Selection sort: A sorting method that repeatedly finds the smallest remaining item and swaps it to the next position of the sorted part. It always performs about n^2/2 comparisons but only up to n swaps.

Level: beginnerTopic: Data structures algorithms

Selection sort: an example

On [64, 25, 12, 22], the smallest, 12, is swapped to the front giving [12, 25, 64, 22], then 22 is chosen next.

Related terms

More Data structures algorithms terms

Where you learn it

Selection 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.