DSA · Reimagined
Sorting easy time O(n²) space O(1)

Selection Sort

Scan the unsorted part for the minimum, swap it to the front of that part, and grow a sorted prefix from the left.

7
0
3
1
8
2
2
3
9
4
4
5

Repeatedly pick the smallest of what remains and place it next.

1 / 40

Practice

Machine twin: /dsa-viz-v2/selection-sort.json — the full deterministic run as structured data.