Algophobic doesn’t mean fear of algorithms! But this might help you understand algorithms a bit better.

Ohletamyleta
3 min readJun 23, 2021
Can’t go to sleep, code will get me…(apologies to The Simpsons)

Algophobic is actually an abnormal fear of pain (which, after studying DSA for a few days, might still be an accurate description of how I’m feeling). I’m not the keenest mathematician, and although problem solving in a practical sense is one of my favorite things, having to come up with solution logic and use it to write functional code can feel a bit overwhelming — especially when faced with a blank whiteboard and my career progress hanging in the balance. Oh, you’re being dramatic! you might be thinking. And as a theatre artist who also happens to be a developer, I will admit that you are correct. But how can I escape my brain and really understand how algorithms work, and use them to slay the demons of my technical interviews?

Step 1: Real world, non-code-based examples of algorithmic logic. (this blog)

Step 2: Real world, non-code-based examples of common data structures. (coming soon)

Step 3: Integrate that knowledge with examples of actual code-based applications (coming shortly after step 2)

Whiskey = JavaScript? Perhaps!

Recipes are, at their heart, algorithms. A set of ingredients (inputs), arranged in a particular order of operations, with a consistent and predictable outcome. So, if we were to pseudocode our way into making an old fashioned, it might look something like the instructions above. Inputs go in (whiskey, bitters, et al), functions are performed (instructions), and output is achieved (happy hour!).

Another example of algorithmic logic that we encounter every day is traveling from one location to another. Let us assume that our intrepid subject is going to take a Lyft ride to the office. Logically, the steps involved for the passenger will need to include:

  1. Use the Lyft app on their device to request a pickup
  2. Wait at the designated location to be picked up
  3. Get into the car
  4. Be taken along the ideal path from point A to point B (least time/distance)
  5. Arrive at the office

The driver’s algorithm would be similar, but also include accepting the request, travelling to the pickup spot, and some sort of function to determine the route taken from pickup to drop off. In real world situations, there are mapping apps that make that decision, but those apps ALSO use algorithms to decide what the best route is.

Sorting algorithms are common in technical situations, but also very common in daily activity. Putting books on a shelf from tallest to shortest, hanging the laundry in your closet by category (shirts/pants/etc.), organizing the silverware drawer so all of the forks are in one spot, and spoons in another. All of these could be transformed into code!

One last example: getting dressed. Leta, that’s not an algorithm, you might say. But it can be! Each time you assemble an outfit, you consider numerous variables: outside temperature/weather, where you’re going, what you’ll be doing, who you’ll be seeing. And every ensemble has multiple parts (an array of items, if you will): top, bottom, undergarments, socks, footwear, accessories. You could (if you were so inclined) write a slew of lines of logic to explain why you wore what you’re wearing right now — that’s an algorithm.

Not so scary anymore, are they? (I hope the answer is at least a little less intimidating!)

Next time, data structures, and what they look like in real world examples!

--

--

Ohletamyleta

Software engineering grad, theatre geek, master punster.