Comparisons and swaps at n = 512
Comparisons and swaps at n = 512
Selection sort performs the most comparisons of any algorithm here and among the fewest swaps — it never moves an element it does not have to. Ordering these algorithms by comparisons and ordering them by swaps gives two different orders, which is why the question "how many operations" needs the operation named before it has an answer.
Drawn at 680 × 380, wide on the page.
Everything above is what two-counts returns with no arguments; the caption is the
generator's own, computed from the numbers in the drawing rather than written beside it.
21 essays call
two-counts. The drawing above is what it returns with no arguments at all; every
call below passes it something, because a placement that passes nothing draws whichever
member of the family the generator happens to default to rather than the one its essay
argues about — which is what optcheck and figfill exist to catch.
Where it is called
Changing this generator changes every one of these figures.