Dissecting Algorithms

Algorithms are the building blocks of Computer Science because our understanding of the world needs to be replicated into machine readable code so that it can be executed.

As advanced as the human brain is, people started to realize that machines can be faster (unbelievably so as time passed) and error-free. Humans make mistakes but machines never do, unless those errors are part of the programming.

Hence our understanding of the real world problems is directly related to how well we will be able to make a machine solve it, or make a machine to solve it!

Maths is the language Humans use to try to solve the problems.

A basic understanding of math concepts is essential to understand and interact with the world right?!


A kilo of mango costs 60 bucks. So how much do you pay for 2.5 kilos?

The above is relatively easy. Now think of the weekly shopping you do at a supermarket. So many different things in so many different quantities. And there are lots of people who are shopping there with you. Does the cashier start writing it all down and then start calculating the cost of each? No, he or she scans the bar-code and voila, your bill is ready. Swipe your card and exit with your shopping bag!

There is quite a bit of work done behind-the-scenes. The inventory and the current cost of each item are kept up to date on the shop computer. Barcode scanner is linked to the computer as well. Also the payments gateway. Everything is linked so that the transaction is automated.

But when you think of it, each of those was done by a human previously. The Bar-code scanner replaced the shopkeeper’s memory of all items in the inventory and their prices. The payments gateway replaced the cash transaction calculated manually and tending of exact change.


In college, we are taught simple programs. A Fibonacci series for understanding recursion. Swap 2 numbers for temporary variables. A stack. A queue. An array for sorting techniques. By themselves, these are just parts. They don’t mean anything. Education gives you the tools, not the knowledge of how the tools are to be applied.

If you write a program that models a real-world problem and solves it, the sum of those parts is what matters. This is something you have to discover by yourself!


In the beginning, programmers try to solve simpler issues. Like games :) I was personally interested in writing a program for all the games I played.. 4 in a row, Sudoku, Chess, Tiles, Tic Tac Toe, Towers of Hanoi. I wrote for all except Chess. Chess falls into the ‘real-world problem’ category as it’s quite complicated!

Once you start writing programs like these, you understand why you need each part — Input, Data Structures, Iterators, looping statements. You tend to see the ‘requirement’ and search for the relevant ‘part’. What do I use for saving this 3x3 grid of data? How do I compute this result? Is it a whole number or fraction?

Once you learn these by trial and error, you move on to the interesting part — algorithms! How do I solve this position of the game? How do I make a move and keep score? How do I evaluate a winning position?

You will understand the difference between a Depth First Search and Breadth First search, and why you need to pick one of those for your particular scenario because you tried applying these techniques to your scenario and discovered why one of these doesn’t work.

Learn to code, it’s fun. And progress onto the different algorithms used. Understand why each is used.

And right now we are in the age of Neural Networks and Machine Learning. Where we throw a generic scenario at a computer and it tries to solve it using other programs we have developed. And it gets better the more data we throw at it.

Wikipedia says Neural Networks is a computer system modeled on the human brain and nervous system. See what I meant earlier about replication of our understanding into code?!

Algorithms are a basic set of guidelines for generic scenarios. If you have these set of inputs, do this. They are exciting because they help us to understand the “how” of a given problem. How do we solve it?

Take a game you like and start coding in your favorite language. That is the best way to learn Algorithms.

And you will create something of value along the way!


Thank you for reading!

If you liked this, click the 💚 below so other people will see this here on Medium.

I would love to hear your thoughts on the same, please leave comments so that we can continue the conversation

The image at the top is from my collection! A variation of which is on my Instagram :)