Book Summary: Algorithms to Live By

How to deal with life, based on Computer Science algorithms

Tazki Anida Asrul
5 min readMay 12, 2023

Life is complicated, and so are humans. When living our life, we often have to face many life decisions. Sometimes we make a great decision, but sometimes we regret our decision. In Computer Science, the decision-making problem is something that we can solve computationally, but how about in real life? Can we calculate everything to resolve our day-to-day problems?

Image source

Brian Christian and Tom Griffiths try to answer the question using this superb book. Algorithms to Live By shows us how we can rationale and apply many kinds of algorithms to our life. Let’s take a look at some of them.

The Optimal State to Stop Looking

Imagine having a scenario when we need to find the best secretary, house, rent, or even soulmate. It might be hard to decide when to stop looking, especially when there are limitations such as time and method — that we could not go back to the previous option and pick another one once we have made the decision. Stopping earlier will possibly fail us to find the best from undiscovered applicants, yet stopping late will make us keep looking for something that might not be as good as the passed option.

Photo by Meizhi Lang on Unsplash

One of the optimal solutions to this “secretary problem” is by following Look-Then-Leap-Rule. With this rule, we need to set a predetermined amount of time to look at the options without choosing anyone, no matter how attractive they are. When we arrive at the leaping phase, we decide to take the one who is better than anyone we have looked before.

Based on some calculations and statistical methods, it turns out that 37% is the optimal number to look at the pool of candidates, before deciding on the chosen one. That is what we call as 37% Rule. The implementation could be in terms of time or the number of candidates.

For example, you have a plan to search for a soulmate from age 18 until 35. In this case, you have 17 years to find the best person for you. Using the rule, we can say that 37% of 17 years is your looking phase. It means you have 6.3 years to learn and gather your criteria based on the available person you have met. After that certain time (when you are above 24.3 years old), whenever you find someone who outshines anyone you have met before that age, choose them.

Sorting

Photo by Alexander Kovacs on Unsplash

Sorting something that you will never search for is a complete waste; searching for something you never sorted is merely inefficient.

Making an order is a common need in our life. However, there are costs and efforts to sort things out. With the many sorting algorithms founded in recent years, there must be algorithms with not-so-good performance. For example is Bubble Sort, which lands us at quadratic time. In the worst case, if we have n books on our shelves, we need to scan n times from the beginning until the end, as we can only move one book at most each time we loop.

The pain is real if we face a sporting contest and we should sort thousands of competitors within a certain time. One way to minimize the cost of making orders are by moving the ordinal number (represents by rank), to cardinal numbers (represents by measurement). In this case, it is possible to set orders without pairwise comparisons or head-to-head matchups.

Having a benchmark solves the computational problem of scaling up a sort.

When to Think Less

When deciding whether we need to choose something over another, making a pros and cons list is one of the common approaches. We might think, “The more pros and cons we list, the better decision we will make” but is it always the case?

In reality, more factors to consider can cause what machine-learning researchers call overfitting.

Including more factors in a model will always make it a better fit for the data we already have. But a better fit for the available data does not necessarily mean a better prediction.

Photo by Ben White on Unsplash

For example, if students are well-performing in a standardized test, how can we know whether they are excellent at the subject or they have been taught earlier to do a similar test?

To be able to distinguish these two matters, we can use an important method called Cross-Validation. Not only to assess how well the model fits the given data but also how well it generalizes to data it has not seen.

With the same student analogy, to ensure that students well-understand the subject, schools can randomly pick a few students from each class to do another test with a different evaluation method. If the score of the first standardized test is significantly better than the score of the second test approach, we can say that the students do not really acquire the knowledge and overfit the first test.

Besides those three examples, this book still contains other kinds of relatable solutions to our daily life problems. With 11 chapters in it, this book vanishes the strict boundaries between machine and human life. To anyone who is interested in computational, technical thinking, and psychology at the same time, I highly recommend this book.

--

--