Selection Sort
Simple, non-adaptive method:
- find the smallest element, put it into first array slot
- find second smallest element, put it into second array slot
- repeat until all elements are in correct position
"Put in xth array slot" is accomplished by:
- swapping value in xth position with xth smallest value
Each iteration improves "sortedness" by one element
|