01How it works
Scan the unsorted region to find the minimum, swap it into the first unsorted slot, then repeat with a shrinking region. The number of swaps is exactly n−1 regardless of input, which is the lowest of any comparison sort.
Find the smallest item remaining; put it at the front.
Scan the unsorted region to find the minimum, swap it into the first unsorted slot, then repeat with a shrinking region. The number of swaps is exactly n−1 regardless of input, which is the lowest of any comparison sort.
Situations where a write is far more expensive than a comparison — flash memory, EEPROM, slow external storage. When every swap costs real energy or erase cycles, the minimal-swap guarantee matters more than total comparisons.
You care about wall-clock time. It does O(n²) comparisons even on already-sorted input, and it isn't stable — equal keys can get reordered.