Why should we care about algorithms? In mathematics and computer science, algorithms are a self contained sequence of actions to be performed. They can perform calculations, data processing, and automated reasoning tasks. In other words, an algorithm is simply a procedure. Let’s look at a real world example of an algorithm.

Remember Yellow Pages? It’s a telephone directory of businesses that are organized alphabetically. If I wanted to find the phone number of Venmo for example, the simplest way would be to flip every page starting from the beginning until I reach the “V” section. Doing this would ensure I eventually find Venmo. It definitely isn’t the wrong way to pinpoint a number, but it’s not necessarily the most efficient option. A better way to approach this would be to open the Yellow Pages directly in the middle. If we open an alphabetically ordered book in the middle, we can assume that we will be in the “M” section. Next we decide if Venmo would fall under the left or right side of the book. As “V” comes after “M” we know that we don’t need to worry about the first half of the book. Now with the remaining pages we can repeat this process of halving the amount of pages until we reach our destination.

Guess what? You’ve officially used an algorithm here! This process is known as the binary search algorithm. We followed a procedure and made our task at hand much more efficient. In the next part we will discuss the time complexity of binary search algorithm which is also referred to as big O notation. In computer science, the time complexity of an algorithm quantifies the amount of time taken by an algorithm to run as a function of the length of the string representing the input. All this really means is how efficient is this algorithm? When using Big O notation, we can determine if the algorithm we used is the best one for the problem at hand or if there’s a better one to use. Happy coding!