Skip to content

Cocktail shaker sort

ordering

Level 1 of 3

Also called Shaker sort and Bidirectional bubble 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

Whole numbers from 1 to 99, between 2 and 12 of them, separated by commas or spaces.