 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
| • |
During
the first pass, you compare the first
|
|
|
two
elements in the list.
|
|
|
|
– |
If
they are out of order, you exchange them.
|
|
|
|
– |
Then
you compare the next pair of elements
|
|
|
(positions
2 and 3).
|
|
|
|
– |
If
they are out of order, you exchange them.
|
|
|
|
– |
This
algorithm continues comparing and
|
|
|
exchanging
pairs of elements until you reach the
|
|
end
of the list.
|
|