Sort Socks: The Bubble Sort

Step 1: Compare and Move

Start at the leftmost position in the array.

Compare the first two elements.

If they are in order, move to the next pair.

If not, swap them.

Step 2: Repeat and Repeat

Repeat steps 1-3 for the entire array.

Go to Cocktail Sort for a Twist!
Back to Insertion Sort