 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
| • |
This
is called a selection sort.
|
|
|
|
– |
It
means that to sort a list, we first need to search for the
|
|
|
largest
key.
|
|
|
|
– |
Because
we will want the largest key to be at the last
|
|
|
|
position,
we will need to swap the last item with the
|
|
|
|
largest
item.
|
|
|
| • |
The
next step will allow us to ignore the last (i.e.,
|
|
|
|
largest)
item in the list.
|
|
|
|
– |
This
is because we know that it is the largest item...we
|
|
|
|
don't
have to look at it again or move it again!
|
|