 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
| • |
Remember
that means for the first time
|
|
|
around
there would be N-1 comparisons.
|
|
|
|
– |
The
next time around there would be N-2
|
|
|
comparisons
(because we can exclude comparing
|
|
the
previously found largest! Its already in the
|
|
|
correct
spot!).
|
|
|
|
– |
The
third time around there would be N-3
|
|
|
comparisons.
|
|
|
|
– |
So...the
number of comparisons would be:
|
|
|
|
(N-1)+(N-2)+...+ 1 = N*(N-1)/2
|
|