What is an Algorithm?

Airen Arakaki
4 min readMay 31, 2021

--

History

The term algorithm comes from 9th century Persian mathematician and geographer Muhammad ibn Musa al-Khwarizmi. The term algorithm was derived from the Latinization of his name to “Algoirtmi” when his book On the Calculations with Hindu Numerals was spread into Europe and translated into Latin as Algoritmi de numero Indorum. This book was critical to the development and utilization of the decimal system we use today. Al-Khwarizmi developed a systematic approach to solving linear and quadratic equations, which was then termed algebra. This algorithmic approach established the basis for modern mathematics.

In 1936, Alan Turing defined a foundational concept for computer scientists in his paper on the Turing machine. He illustrated that problems could be broken down and solved by machines executing algorithms to perform operations.

Algorithm

An algorithm is a set of steps used to compute a specific task. There are the building blocks for programming and they allow things like computers, smartphones, and websites to function and make decisions. But in addition to being used by technology, a lot of things we do on a daily basis are also similar to algorithms.

Let’s say you want to make some spaghetti🍝 In order to do this successfully, there is a certain set of steps. First, you need to boil a pot of water. Once it is boiling you then add the spaghetti and cook it for a set amount of time, stirring occasionally. Once it is finished you drain the water and then it is ready to be served with a sauce of your choice. That entire process is actually an algorithm. Because you followed those steps in that order, you reached your desired outcome, a delicious pasta dish! But, if you were to make a mistake, say over or under-cooking your noodles. It probably would not be as good.

Program work in a similar way. Their code is made up of algorithms telling what to do.

Let’s say that we want to use a navigation app to get directions. When we punch in a destination, the app uses an algorithm to look at the various available routes. Next, it uses a different algorithm to check the current traffic. And then a third one mistakes that information and calculates the best available route. All of these algorithms are built right into the code of the app. If there were any kind of error in that code, the app would not be able to follow these algorithms correctly. That meaning, you would not receive your directions.

Both of these examples show how both humans and computers can use algorithms to perform everyday tasks. The difference is that computers can use algorithms and calculate things better, faster, and more efficiently than we can.

Types of Algorithms

Algorithms are classified based on the concepts that they use to accomplish a task. While there are many types of algorithms, the most fundamental types of computer science algorithms are:

  1. Divide and conquer algorithms — divide the problem into smaller subproblems of the same type; solve those smaller problems, and combine those solutions to solve the original problem.
  2. Brute force algorithms — try all possible solutions until a satisfactory solution is found.
  3. Randomized algorithms — use a random number at least once during the computation to find a solution to the problem.
  4. Greedy algorithms — find an optimal solution at the local level with the intent of finding an optimal solution for the whole problem.
  5. Recursive algorithms — solve the lowest and simplest version of a problem to then solve increasingly larger versions of the problem until the solution to the original problem is found.
  6. Backtracking algorithms — divide the problem into subproblems, each which can be attempted to be solved; however, if the desired solution is not reached, move backwards in the problem until a path is found that moves it forward.
  7. Dynamic programming algorithms — break a complex problem into a collection of simpler subproblems, then solve each of those subproblems only once, storing their solution for future use instead of re-computing their solutions.

Technology is only going to continue to evolve and get even better at what it does. As long as coding and programming continue to be used algorithms will be the heart of these technologies guiding what they do and how they do it.

--

--

No responses yet