You've stumbled across the archive of the blog posts I wrote some 8 years ago or so. Feel free to peruse, through everything from code snippets that never made it to GitHub, to random ramblings about my passion for technology.

Sorting arrays is one of the simplest things for the human mind, but to put it into code is a little different. We can look at the numbers 7, 4, 4, 12, and 5 and know what order they go into (4, 4, 5, 7, 12), but to a computer the numbers are just numbers and don't really mean anything. They're simply a tool for the program to do something with; as far as the computer cares, the order is irrelevant.

But many, many programs require sorting. Imagine a tax recording program, that has to sort by value. Imagine a spreadsheet program that has to sort cells by date added. Perhaps you have a game that sorts users by score. Even the text you're reading now is stored in MySQL and is sorted by date added (or ID).

No matter how you slice it, programs have a need to sort things, be it numerically or otherwise. But especially for beginner programmers, thinking of how our brain sorts those numbers isn't so easy.

Continue reading...