Computer Science Algorithms Applied to Everyday Life

TLDR: A variety of algorithms can be used to your advantage, not to just make your code more efficient, but your life as well.

Your day to day approaches to getting things done is a system to be tweaked and you’re the mechanic. Choose your algorithms wisely!

Brute Force

The seemingly optimal thing to do is use brute force, just get a task done. With that said, taking a step back and approaching every task with a clear strategy and purpose may be more effective.

Imagine it takes you 60 minutes to painstakingly grind out that problem set from math class. Perhaps hitting some jumping jacks and thinking about why you’re about to do this task will enable you to complete the job in 40 minutes (and with more purpose).

What if you aren’t sure how much time to spend getting into the right mental state? After a certain amount of time has passed, couldn’t this make you less productive? To answer how much time and effort is worth sacrificing for optimality, let’s turn to backtracking or even branch and bound.

Backtracking + Branch and Bound

Let's say the criteria of a decision states “choose a college to go to” and you live in Idaho, but you also happen to be the smartest person in the world.

If the algorithm you create starts with local colleges and expands outward, the backtracking algorithm will find a local community college (a solution) and branch and bound will find Harvard (the best solution). Since the algorithm looks at local colleges first, let's say it takes 1 day for the algorithm to find a nearby community college and 15 years to find Harvard.

Well, now you have a choice to make. Would you rather wait for finding out about Harvard or go to community college tomorrow and get a degree within four years?

Point is, different algorithms will give you different outcomes. If you have a 3-minute email to write, spending 45 minutes in deep meditation to set your mind straight is not practical. At the same time, a quick breath to set yourself straight may be just what you needed to craft a perfect message.

It’s all a game of tradeoffs. Quite a few of these tradeoffs have to do with short term or long term payoffs. This brings us to the concept of Greedy algorithms.

Greedy algorithms

Imagine you’re at a buffet. There are 100s of deserts and you could analyze each one, think about the taste and number of calories of each bite and then make a calculated decision. If you’re like me, you’ll probably do this and take 20 minutes to decide. If you're not crazy, however, you’ll probably just pick a section of the table and find the best thing that’s right in front of you. This is using a Greedy algorithm and is probably the best approach to finding a desert.

Let's apply some greedy algorithms to getting a job in Private Equity (PE) after graduating college.

One could go directly from school to PE or they could do investment banking for 2 years and then go into PE. Clearly, the greedy thing to do (best short term move) is to go right into PE.

Now, let's say the real goal is to be a manager at a top-notch PE fund. The thing about being in a higher role is it may require more experience and a more specific type of experience (often IB experience). So, the optimal scenario here may be to do Investment banking first, even though it adds an extra step and a couple of extra years.

Be careful with how greedy your algorithms are — long term greedy decisions always win.

What are some other algorithmic strategies out there? Let’s dive deeper into breadth-first and depth-first search.

Breadth-First Search and Depth-First Search

The same algorithm could be used in dating, jobs, or whatever. Start off broad to figure out what you vibe with most and once you know, go all in. When you fall in love, get married - when you find the job you love, make a career.

We approach too much of our world and tasks to be done from the perspective of brute force. Perhaps the most efficient strategy is taking a few minutes to get in the right mindset, figure out what approach to a problem you should take before acting, and most of all, know which algorithm you’re using at a given time.

I’ll leave you with a single question: what algorithms do you want to use today and is life just a game of figuring out which algorithms work best for you at a given time?

I want to thank Hamza, Chase Chapman, and Rebecca Andrews for their help on this piece!