What is an Algorithm?

An algorithm is a set of instructions typically undertaken by a computer to reach a targeted goal. But, what does that really mean?

When you make a sandwich, you are performing an algorithm. Even if you do not know it. Habits are algorithms. Do you put your socks and shoes on in the order sock > sock > shoe > shoe or do you do sock > shoe > sock shoe? Both of these are algorithms.

Where does the word algorithm come from? It’s a bit of a funny word. Actually,

Algorithms have a long history and the word can be traced back to the 9th century. At this time the Persian scientist, astronomer and mathematician Abdullah Muhammad bin Musa al-Khwarizmi, often cited as “The father of Algebra”, was indirect responsible for the creation of the term “Algorithm”. In the 12th century one of his books was translated into Latin, where his name was rendered in Latin as “Algorithmi”.

From here

Normally algorithms break down things that we as humans think are very simple and easy into little steps that a computer can perform, let’s say that you want to find the number 3 in the list [1, 2, 3]. You look at it and you see it, but a computer can’t see the number 3 in the list until it goes through every single item to check. Computers are the fastest dumbest things to ever be created, because it’s so easy for us to just “look” and see.

This is a good video showing how precise and “stupid” computers can sometimes seem:

https://www.youtube.com/watch?v=cDA3_5982h8

Algorithms exist everywhere. Ants use an algorithm to find the shortest path between food and their nest. Birds and fish use algorithms to locate food. Algorithms are found everywhere in life.

img

Even Medium uses an algorithm to decide what posts get into the top 5 trending posts on Medium.

Algorithms are essential in Computer Science, you simply cannot live without them. Something computer scientists do a lot is compare how long an algorithm takes to run against other algorithms, kind of like a race. This will be the discussion of the next post in this series.

TK next article