Selection sort
lastmod 2018-08-17created 2015-11-101 edits
Selection sort is an in-place sorting algorithm that works in the following order.
- Find the minimum value in the given list.
- Swap that value with the value at the front (a pass).
- Swap the rest of the list, excluding the first position, in the same way.
Assuming comparisons take constant time, sorting a given list of n items this way takes O(n2) time.