The Selectionsort Algorithm
p
Start by
finding the
smallest
entry.
p
Swap the
smallest
entry with
the
first
entry
.
[0]
[1]
[2]
[3]
[4]
[5]
...like this.
The smallest element is now at the front of the array, and we have taken one small step toward producing a sorted array.