Sort with three-way compares
You will learn
How a sort uses compares that also answer equal.
Three compares sort three numbers: the left pair, the right pair, then the left pair again. Each compare answers less, equal or greater in one go, so two equal sevens are settled by a single compare and never swapped. Sorting with ties then needs no extra test.