You’re Probably Using an Algorithm to Read This (and Get to the Store)

An intuitive way to think about and analyze algorithms

When you think of algorithms, what comes to mind? For those of you who work outside of computer science, you probably think algorithms are inextricably linked to technology. But the reality is that they don’t always have to be. There are several examples of algorithms—both high and low tech—around you every day that you may not even be aware of.  

Recommendation engines are a type of algorithm that have gained increased awareness, for instance. Countless news articles have questioned the impact they have on things like YouTube’s content recommendations and what news you see on various websites.  

Other algorithms affect credit ratings, lending rates, and a range of other financial metrics. Many areas of life—particularly ones related to or using “high-tech”—increasingly make use of algorithms and their input data. And yet, even some of the folks who benefit from algorithms in their business don’t fully understand how they work—they often throw around the term “black box” to describe them.

You may be surprised to learn that algorithms exist in low tech settings as well. Your brain uses them every day for nearly every decision you make. Read on to gain a deeper understanding of what algorithms are and explore a practical example of how we all use them in our day-to-day lives. 

What is an Algorithm?  

 

Algorithms are step-by-step procedures (or instructions) for solving some problem.

This definition may seem a bit broad, but it’s quite appropriate. Some problem—not necessarily a particular problem, just some type of problem—leaves room for a wide variety of use cases. That includes the technology-based cases above, like recommendation engines or credit scores.  

Yet we also use algorithms—even subconsciously—in simpler ways, like picking out an outfit for a party. Or suppose I need to go to the store and there are multiple ways to get there. How do I know which route to use? Let’s explore the algorithm for making that decision below.  

A Practical Example of Everyday Algorithms  

I’m out of bread, and I need to go to the store to get more. There are two routes I can take to get to the store from my house. They’re about the same distance and (theoretically) should take about the same amount of time. Factors such as construction, one route having more traffic lights (but also more lanes) vs the one being single lane, etc., make up the difference. 

Each time I go to the store, I “just pick one” of these routes. I’ve never quite committed to one over the other and there seems to be some sort of subconscious process for making this decision. That subconscious process—the way I go about choosing which route to take each time—is, in general, consistent with concepts surrounding the design and analysis of algorithms. 

In many use cases we choose algorithms that have the “most favorable worst-case scenario” for any variation of all instances of a problem. In other words, when choosing between several algorithms for a given problem, we often select the one that on average, regardless of the input, provides the best output. When I go to the store, I’m less concerned with the fastest possible way to get there and more focused on avoiding the longest way to get there.  
 
In this case, the time of day, construction, and other random road closures seem to be the attributes that will make one trip take longer than the other at any given time, so I tend to pick the “less congested route” during peak hours and the other one on off hours. 

Two common ways of setting algorithm instructions.

Analyzing Algorithms 

The analysis of algorithms is the process of finding the computational complexity of algorithms.
 

Wikipedia 

Once you determine the parameters of your algorithm, you need to analyze its ability to lead you to the most favorable worst-case scenario. First, you want to ensure your algorithm is correct (although at times you can use some that work “well enough” or are “mostly correct”). You’ll also want to know how efficient it is. 

Taking a step back, it’s important to keep in mind that one of the keys to designing and thinking about algorithms is the abstraction of particular details. Going back to the store example, it’s common to give directions like in sample sentence number one, whereas most of us don’t give directions like in sample sentence number two: 

  1. “Make a right, then take the third left.” 
  1. “In 1.17 miles make a right, then go another 2.8 miles and make a left.”  

Sometimes we may want specificity, but oftentimes we reduce a problem (in this case a set of instructions) to a simpler interpretation. This practice of reduction—reducing some problem X to another problem Y—makes sense not only while giving directions but is also a primary concept in designing algorithms. In this context, defining the problem itself prior to the procedure to solve it makes a big difference. 

Now that we’ve explored an everyday example of how we use algorithms, we hope you’ll start to see the magic of algorithms everywhere, both in high and low-tech scenarios. Be sure to stay tuned for the next post in this series, where we’ll discuss how to use reduction to design an algorithm and analyze their performance. We’ll also discuss the asymptotic notation used to describe the behavior and performance of a given algorithm such, including Big O, Big Ω (Omega), and Big Θ (Theta). 

Looking for more content on algorithms, recommendation engines, and more? Sign up for our newsletter to get fresh tech takes delivered to your inbox each month. 

Get alerted to new job postings, events, and insights by registering for our monthly newsletter.