4 ms·
To be concrete, the array in order 1235647 has the first six comparisons go the same way as in 1234657, but it doesn't end up sorted in one pass. Perhaps harry
by somecontext 9y ago
To be concrete, the array in order 1235647 has the first six comparisons go the same way as in 1234657, but it doesn't end up sorted in one pass.
Perhaps harry8 was thinking of the bubble sort implementation in the OP, which would indeed stop after one pass in these cases.