Algorithmic Sock Sorting - Merge Sort

Sort a mess of socks with the most efficient algorithmic approach - Merge Sort!

Step 1: Split the Sock Mess

Split the Socks into Two Piles

Take your socks and divide them into two piles, one for each type.

Socks: 10 pairs
Socks: 20 pairs
Socks: 15 pairs

Step 2: Sort the Piles

Sort each pile in a sorted order, using a stable algorithm.

Sort the Piles
Socks: 10 pairs
Socks: 15 pairs
Socks: 20 pairs

Step 3: Merge the Piles

Take the sorted piles and merge them into a single, sorted list.

Merge the Piles
Socks: 35 pairs