Starting with current at position 0
while current is not the size of the array
Find the smallest item in the rest (to the right) of the array.
Swap the smallest item and the item at position current
Increment current
current search smallest 0 1 2 3 4 5
5 3 4 2 6 1
Sort(A[], size)
- for current ← 0 to size-2
- smallest ← current
- for search ← current+1 to size-1
- if A[smallest] > A[search]
- smallest ← search
- if current ≠ smallest
- swap(A[current], A[smallest])