Justifying Sock Pile via Bubblesort
Because, clearly, socks are a complex problem that requires the most basic of algorithms
Here's the algorithmic approach:
- Start with a giant heap of socks
- Take a sock from the top
- Compare to the last sock taken
- If it's smaller, put it at the bottom of the list. Otherwise, add it to the bottom of the heap.
- Repeat until done.
But honestly, who needs this when you have QuickSort?
Or just use Heapsort, the hipster's choice
Now you have a justifiably sorted sock pile