top of page
  • Writer's pictureEric Young

Algorithms in Real Life: What is an Algorithm?

Updated: Jul 18, 2021

They are everywhere. 

From social media apps and search engines to video streaming sites and dating apps, algorithms are everywhere in our modern, technology-driven world. 

But what exactly is an algorithm? 

How do they work? 

Who makes them? 

And should we be worried about them? 

Let’s figure out. 


With a quick Google search, we see that an algorithm is defined as “a process or set of rules to be followed in calculations or other problem-solving operations, especially by a computer.” This might sound like a riddle to you. There are so many definitions on the internet that do not clearly explain what algorithms actually do. I’m here to help!

A non-internet based example of an algorithm is a cookbook recipe. A recipe provides a set of instructions to specify how you should put together several ingredients to get a product (eg. sandwich) on the other end. In the peanut butter and jelly sandwich example above, we are given 2 slices of bread, 1 tablespoon of peanut butter, and 2 tablespoons of strawberry jam as inputs to our algorithm. The algorithm we use to make the sandwich might include the following procedures: 

  1. Gather Your Ingredients for the Sandwich

  2. Pull Out Two Slices of Bread

  3. Open Peanut Butter and Jelly

  4. Spread the Peanut Butter Onto One Slice of Bread

  5. Spread the Jelly Onto the Other Slice of Bread

  6. Combine the Two Slices

After completing the instructions specified by the algorithm, we are able to accurately produce our output  ― a delicious peanut butter and jelly sandwich! 

Algorithms in Computer Science:

An algorithm in Computer Science does effectively the same thing ― it is a set of instructions that enables a computer program to put together different input sources and output a result. 

While a programmer implements code to specify the algorithm for recommending new YouTube videos or which post you see first on your Facebook feed, users are usually unaware of how an algorithm is designed. As a user, you can treat an algorithm as a “black box” – you provide valid input information and wait to see the magic happen. When we use Google Maps to find the fastest route to a destination, we don’t need to worry about what computations we need to make to locate the shortest path (thank god!). We simply provide the algorithm with relevant input information such as our starting point, destination, and mode of travel and the algorithm automatically generates the best path for us. This principle of removing unnecessary details (e.g. how the shortest path is computed) to boost user experience is a recurring concept in Computer Science known as “abstraction”. 


How do we know if an algorithm is well-designed? We can start with analyzing its “correctness”. It is likely that you have experienced the frustrations of dealing with a poorly-designed algorithm yourself. When I was child, my parents purchased a new car GPS navigator. On a road trip, the GPS incorrectly led us to a rural farm and instructed us to drive into a field of crops. Luckily, we quickly disregarded the misguided directions and eventually found our way back on track. In this case, the GPS algorithm was “incorrect”. In other words, it failed to produce the correct output we were looking for ― a feasible path to our final destination. In certain high-stakes situations, incorrect algorithms can even yield life-or-death consequences. On March 19, 2018, an Uber self-driving car running in autonomous mode hit and killed a woman walking on a poorly lit road. According to Uber, the algorithm incorrectly classified the women as “unknown object”, then “vehicle”, and then “bicycle” during the brief encounter. It is this indecisiveness that led to a very late action (stopping the car), which eventually caused the tragedy. Algorithms are useful when they are correct, helping us automate tedious tasks, find valuable information, and perform complex procedures. On the other hand, incorrect algorithms do more harm than good, from wasting time to even taking lives. 


We can also analyze an algorithm by evaluating its “efficiency”. Going back to the Google Map example: What if a search for the fastest route to a nearby destination takes an hour? If driving to the destination only takes 15 minutes on average, there is no point in making the search before traveling there. Even if we choose a slower route from our memory, we would still arrive at the destination faster than waiting for the app recommendation result and taking the fastest route. This shows how even if an algorithm is correct, it is ultimately unhelpful if it takes too much time to run. 


Algorithms are not as difficult to understand as many people think ― they show up in many facets of our daily lives and help us better utilize the resources around us. 

14 views0 comments

Recent Posts

See All
Post: Blog2_Post
bottom of page