Selection Sort
Scan the unsorted suffix for its minimum and place exactly one value on every outer pass.
Core idea
For each output position, scan the entire remaining suffix and remember its minimum. One final swap places that minimum and grows the sorted prefix by exactly one.
Read the visualization
The scan pointer visits every candidate while a separate marker follows the best minimum seen so far. Only the pass-ending swap changes the array.
Begin a pass that will choose the minimum of the unsorted suffix.
Complexity and tradeoffs
Time: O(n^2). Space: O(1). It performs only O(n) swaps but is generally unstable and always makes quadratic comparisons.
Where it fits
Selection Sort is useful when writes are much more expensive than comparisons because it performs only a linear number of swaps. It is otherwise mostly a compact teaching algorithm.