SELECTION-SORT(A) Input: A an array of items with the comparison operator Output: the array A ordered by the comparison operator
- current ← 0
- while current < A.size
- small ← A[current]
- for next ← current +1 to A.size
- if A[next] < A[small]
- small ← next
- if small ≠ current
- swap(A[small], A[current])
- current ← current + 1