Why Algorithms Matter: What a Sorting Project Taught Me About Programming

When I started learning programming, I thought most problems could be solved by just writing enough code. Eventually I realized something important: the hardest part isn't always writing the code , it's deciding what the code should do. That's where algorithms come in.

While working on a sorting project recently (a Push-Swap implementation, where you sort numbers using two stacks and a limited set of operations), I had to think hard about different ways to sort data, how those approaches scale, and how to work within strict constraints. What caught my attention was the algorithmic thinking behind it, and that's what I want to share.

What Exactly Is an Algorithm?

An algorithm is a step-by-step procedure for solving a problem. Say you have 5 2 8 1 3 and you need 1 2 3 5 8. Getting there is straightforward in principle, but there are many ways to do it: