|
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
| • |
In
the best case, when the data is already
|
|
|
|
sorted,
only 1 pass is needed and only N-1
|
|
|
|
comparisons
are made (with no exchanges).
|
|
| • |
Sort
in class the following:
|
|
|
|
– |
29,
10, 14, 37, 13, 12, 30, 20
|
|
|
| • |
The
bubble sort also requires both
|
|
|
|
comparisons
and exchanges (i.e., swaps).
|
|
|
|