Skip to content
Sortingintro

Selection Sort

Divides the array into a sorted prefix and an unsorted remainder, repeatedly selecting the minimum of the remainder and swapping it to the boundary. Always quadratic, but performs at most n−1 swaps.

Best
O(n²)
Average
O(n²)
Worst
O(n²)
Space
O(1)
Stable
No