 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
| • |
Notice
that the list is not sorted after this first
|
|
pass.
|
|
|
|
– |
We
have just "bubbled" the largest element up to
|
|
|
its
proper position at the end of the list!
|
|
|
|
– |
During
the second pass, you do the exact same
|
|
|
thing....but
excluding the largest (last) element in
|
|
the
array since it should already be in sorted
|
|
|
order.
|
|
|
|
– |
After
the second pass, the second largest element
|
|
in
the array will be in its proper position (next to
|
|
|
the
last position).
|
|