(Image credit: Shutterstock / carlos castilla)

What is an algorithm?

Problem-solving with a list of rules


Algorithms affect our daily lives more than we care to think and, most of the time, we don’t even know it. We use algorithms in our daily commute to work, or as you cook your favorite Gordon Ramsey Beef Wellington recipe or bake your favorite key lime pie. As you follow through the steps of a recipe, i.e., exact measurements of each ingredient and even temperature control, you’re able to create the pie as desired - neither sloppy nor rock solid. 

In his book, The Art of Computer Programming, Donald Knuth describes algorithms as a confusing word. Learning about algorithms, it’s easy to agree with this description. Merriam Webster defines it as, “a step-by-step procedure for solving a problem or accomplishing some end - so let’s look into a few more examples first.

Google’s search engine allows us to get search results within milliseconds because it uses an algorithm. How? Google searches involve scanning millions of web pages for the keywords you entered and giving you results in a fraction of a second. At present, there are probably over 200 algorithms Google uses that we aren’t privy to, but the company was using PageRank, which essentially measured the significance of websites to your search term or keyword to give you the best possible links, before its patent expired.

As another example, the suggestions you see when you’re browsing for movies or TV shows on Netflix are not at all random. The platform uses an algorithm to monitor not only what you’re watching but also when you’re watching, where you’re watching and how long you’re watching for. 

Your favorite social media sites such as Facebook, Instagram and Twitter, all use algorithms too. The ads you see follow certain algorithms to show you content you might like and products you might be inclined to purchase.

Is that all there is to algorithms?

Absolutely not. Algorithms are key in the fundamentals of programming, and if you’re more interested in coding than baking, learning about algorithms should always be your first step. 

Keep in mind that algorithms will not require an in-depth knowledge of computer programming or programming language.

Is there such a thing as a good/bad algorithm?

Algorithms govern many things that happen in the world today. The GPS device taking you to your destination uses an algorithm, the website booking the flight to your next travel destination uses an algorithm, sending emails require algorithms, video games use algorithms, even video conferencing with your workgroup uses an algorithm.

Algorithms created with good intentions can yield negative results, but it’s all very subjective. It’s safe to say there can be good or bad algorithms, depending on the intention and consequences.

Secure Hash Algorithm 1 (SHA-1), a cryptographic hash function used for producing hash “digests” (each 40 hexadecimal characters long), can be considered a good algorithm. It has been supported by Secure Shell, which is responsible for encrypted connections in millions of computers.

However, due to growing security concerns, SHA-1 has placed millions of websites at risk after an encryption fault, which could be considered a negative consequence.

Do algorithms make computers smarter?

Algorithms are important in writing code, as this tells the computer what you want it to do. Whether you want to open a browser, inspect an element, search for an app - every command goes through an algorithm that lets you communicate with the computer, making it do exactly what it needs to.

Do algorithms involve mathematical equations?

Often, but not always. The important thing to note is that algorithms cannot be vague, otherwise any desired outcome will be unattainable.

Let’s take a look at one example: an algorithm created for the American tax system has been reused elsewhere without amendment, resulted in uncollected tax revenue in the UK amounting to up to £31 billion. The algorithm is responsible for calculating taxes, but using the wrong algorithm in the wrong situation can cause detrimental consequences.

I want to learn more about algorithms. Where should I start?

You can start by building your logic, problem-solving skills, and moving on to basic programming (Java, C++, C, Python, etc.). In programming, algorithms play an invaluable role in problem solving, so it is important to note that algorithms have a larger impact in our world than simply getting millions of crawling links within milliseconds of searching on Google, or baking the best key lime pie. 

More so, learning about algorithms is not something you can do by reading a single article in one sitting - fortunately, there are a wealth of  resources available online you can use in your search for a better understanding of algorithms.