Selection Sort

Find the minimum in the unsorted suffix; swap it to the front. Repeat n-1 times.

Best: O(n²) Worst: O(n²) Space: O(1) Writes: n-1 Not Stable
slow fast
Default
Comparing (j)
Current min
Swap
Sorted prefix
Pass
0
Step
0/0
Comparisons
0
Swaps
0

Algorithm Trace

Press Start to run. Selection Sort finds the minimum element in the unsorted region and swaps it to the boundary on each pass.