Cocktail shaker sort
Bubble sort walking both ways. A walk to the right carries the biggest number left to the right end, a walk back carries the smallest to the left end, and the two ends close in until a walk swaps nothing.
- comparisons
- 0
- swaps
- 0
step 1 of 1
Examples