Do you know what an algorithm is? We come across the word quite often but do you know what it means? It may be a mathematical term but it is not only related to math and science. In fact, an algorithm is defined as a process or set of rules to follow to solve a problem. Therefore, a problem could relate to a decision, a puzzle, pattern or even a recipe. Each of these has steps to follow and can therefore have an algorithm associated with it.

So, how comfortable are you with the algorithms of your life? Not only are you faced with numerous computer algorithms daily but other intuitive algorithms play an important role in your decision making. Are you ready to find out how to make the most out of algorithms?

In this book summary readers will discover:

- The optimal stopping algorithm
- How algorithms can help you sort out your office and life
- Algorithms and probably outcomes
- The limitations of algorithms

## Key lesson one: The optimal stopping algorithm

We all know what it feels like to be faced with too many options. How do you pick your next car or house? Our judgement in these situations is blurred as the first thing we see becomes the standard to which we compare something else. That is until you find your next favourite, which you then start comparing everything that comes after to. This could, theoretically, carry on forever if you don’t make a choice. Worse yet, your favourite might be gone by the time you realize that that should be the one to get. So, how do you choose in this situation without missing a good option?

The optimal stopping algorithm was designed to stop this exact problem. In this algorithm, the magic number is 37 per cent. Therefore, if you were considering 100 houses, you would not choose any of the first 37 houses that you view. What you should do with the first 37 is establish a standard. How many rooms would be ideal, exclude houses without a big kitchen – basically use those houses to build your ideal home in your mind. Then, after you have established this you pick the first house from number 38 onwards that meets this ideal. The algorithm does not guarantee the best house, but the one that is most optimal. In other words, it’s better than choosing blindly.

So, all you have to do is remember 37 per cent. It will come in handy when you have to choose from multiple options like jobs, cars or even a significant other!

## Key lesson two: How algorithms can help you sort out your office and life

When it comes to your office, are you the only person who knows where anything is? In all honesty, it is your workspace, as long as you can find what you are looking for, there’s no real issue. However, if people cannot find you behind the tower of files, it might be time for a quick clean up.

There are a few different algorithms that you could choose to use in this situation. The first is called the bubble sort method. It is not the most efficient method around and works by organizing a pair of items at a time until everything is sorted. As you can imagine, this can be time-consuming because you have to repeat the process going through everything all over again as you sort.

The next option is called the insertion sort. With this method, is to gather all the items you wish to sort and go through them one by one, sorting as you go. In this manner, everything is placed in its designated place in the correct order as you sort. There is no comparing. Lastly, there is the merge sort method. This method requires you to randomly divide everything into piles, sort out each pile and then merge the same piles together at the end.

You can also look at how computers store data in order to get some inspiration. Computers either store data in a hard disk drive or a solid-state drive. Hard drives can store more data than solid-state drives but solid-state drives get data to you much faster than hard drives. Then there is the cache, which stores all the important and most used data. Since the cache is the ‘top layer’ of memory in a computer it can be retrieved much faster than the others. A simple algorithm called Last Recently Used is used to determine what goes into a computer’s cache. As the name states, it simply places the last used files in the cache.

Likewise, you can organise the physical files on your desk in the same manner. The most recently used and most frequently used stays on top and is essentially your cache. Even our brains utilise this method. If you don’t use some information for an extended period of time, you have trouble recalling it. In contrast, if you keep accessing that information over and over, like practising for a presentation, that information is easily accessible as it is in the forefront of your mind.

You can also use algorithms to organize your time and ensure that your work is completed in time. The Earliest Due Date Algorithm is simple and allows you to sort out multiple tasks when you don’t know what to start with. As the name implies, you begin with the task that is due first, hence you prioritise them by their due dates. Moore’s Algorithm comes into play when you know for certain you are not going to be able to complete all your tasks. In this method, you leave out the tasks which will take up the most time and deal with everything else. In this manner, you get more work done overall.

## Key lesson three: Algorithms and probably outcomes

Algorithms have been used to predict probable outcomes from as early as the eighteenth century. Reverend Thomas Bayes came up with a basic method to predict the probable outcome of events in the future given the outcomes of similar events which occurred previously. To try and explain Bayes method, consider lottery scratch tickets. He would have tried to predict the outcome of purchasing a winning ticket by first hypothesizing how many winning tickets were in circulation. Then he would use this to calculate the probability of the results if the tickets purchased. The more information your gather over time regarding this, the more accurate your next hypothesis would be.

However, since Bayes’ method emerged, math has developed far superior and accurate methods to predict probable outcomes. Specifically, distribution patterns are what helps predictions. Normal distributions can help us predict the average age of a group by assuming that few people fall at the extremes on either end of the median. This means that there are few young and few old people and most of them fall in the middle. Then there are power-law distributions which indicate that most people fall below the average and very few are above it. This is what is seen when looking at wealth distribution.

There are also algorithms now that can help determine what people will do and also help make decisions given this information. Game theory usually comes into play when determining the outcomes of decisions. There can be a strategy used where options are given and the choice is based on the reward offered. Therefore, you expect a person to move towards the maximum reward. Then there is mechanism design which instead of providing options with desirable rewards, causes people to behave in a specific way. Take for example employees who never use their vacation days. Most companies make vacations mandatory so that employees are forced to use their vacation days.

Algorithms can therefore come in very handy if you know how to use them in these situations. You can predict outcomes and base your decisions on them. A useful tool indeed!

## Key lesson four: The limitations of algorithms

As much as algorithms are useful, they also have limits. Depending on the data you are working with, your algorithm may become too complex. In fact, it is a trap that most people fall in to given the data we work with today. There are often too many variables to consider. Even though you may have a simple data set to begin with when you develop your algorithm to make predictions, you may find that the presence of all the variables you identify may make it extremely complex. This is called overfitting.

The problem with overfitting is that the algorithm developed is so perfectly tailored to the data set you are working on that it would be impossible to use it for anything else. Even slight adaptations to the model would lessen the predictive power of the algorithm. Therefore, it is important to realise that no algorithm is perfect. When developing an algorithm aim for the best fit as opposed to the perfect fit.

**The key takeaway from Algorithms to Live By is:**

We are surrounded by algorithms in our daily lives and contrary to popular belief, they do not only pertain to math and computers. Algorithms can in fact be handy tools that we use to make decisions, predictions and to work more efficiently. You just have to learn how to use them to your advantage and understand their limitations. If you do, there will be nothing that can stand in your way.

**How can I implement the lessons learned in Algorithms to Live By:**

When it comes to getting work done it can be hard to prioritize when you have multiple tasks with similar deadlines on your to-do list. In order to get the most work done in the shortest possible time, you can try working without distraction. This means you should focus on one task at a time and ignore any work that comes in once you start. In this manner, you eliminate distractions that come in via email and that take your time away from your important tasks. Whilst you are at it, it is worth remembering that your to-do list never ends, so don’t feel disheartened when it continues to grow even after you get things done.