🧮Selection Sort
Also known as Selection Sorting, Select Sort
Find the smallest item left. Move it to the front. Do it again and again.
Think of it like
It is like picking teams by height. You find the shortest child, put them first, then find the next shortest.
Example
Jack sorts five cards: he finds the 1 and swaps it first, then finds the 2, and so on to the end.
Why it matters
It is one of the easiest sorts to understand, so it is often taught first. It also shows why some sorts are slow.
Definition
Common mistake
Key takeaways
- 1Find the smallest. Scan what is left each pass.
- 2Few swaps. At most one per place.
- 3Always slow. About n squared, even when sorted.