Overview
Selection Sort scans the unsorted part of the list, finds the minimum value, and swaps it into the next sorted position.
Sorts by repeatedly selecting the smallest remaining item.
Compact metadata for implementation and discovery.
Selection Sort scans the unsorted part of the list, finds the minimum value, and swaps it into the next sorted position.
Quick facts
Runtime and memory behavior at a glance.
Best
O(n^2)
Average
O(n^2)
Worst
O(n^2)
Space
O(1)
Highlight the current minimum while the unsorted range is scanned.
Selection Sort operates in O(n^2) time and O(1) space within the Selection Sort family. Often compared with Bubble Sort and Heap Sort.
What each reference supports for this entry.
Textbook support for Selection Sort invariants, recurrences, relaxation rules, or asymptotic analysis.
Open sourceGood next jumps from the relationship graph, ranked for useful discovery.
Sorting · Foundation
Both are simple quadratic sorts, but insertion sort adapts better to nearly sorted data.
Compare with thisSorting · Core
Selection sort reduces swaps compared with bubble sort while keeping quadratic comparison cost.
Compare with thisSelection sort reduces swaps compared with bubble sort while keeping quadratic comparison cost.