Article directory
simple selection sort
In a set of numbers to be sorted, select the smallest (or largest) number and exchange it with the number in the first position; then find the smallest (or largest) number and the number in the second position in the remaining numbers Swap, and so on, until the n-1th element (the penultimate number) is compared with the nth element (the last number).
If you read the animation below carefully, you should understand
Traverse the sequence, scanning the sequence backwards at the current position each time, note the position of the minimum value, and then swap the minimum value with the value at the current position
Simple selection sort algorithm features
time complexity: