 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
| • |
But,
think about the best case...
|
|
|
| • |
The
best case occurs when the original data
|
|
is
already sorted.
|
|
|
| • |
In
this case, we only need to make 1 pass
|
|
|
through
the data and make only N-1
|
|
|
comparisons
and NO exchanges.
|
|
|
| • |
So,
in the best case, the bubble sort O(N)
|
|
|
(which
can be the same as an insertion sort
|
|
|
properly
formulated)
|
|