Selection Sort

Find the minimum element and swap it to the front each pass.

Sorted
Current min
Comparing
Unsorted

Controls

Time: O(n²) always | Space: O(1) | Not stable

Steps