**An algorithm in simple terms is a step-by-step set of instructions that shows the process of accomplishing a specific task.**

Yeah! That’s an algorithm.

Here is an example of an algorithm for “how to make coffee at home”;

- Heat up a cup of water
- Add 1 to 2 teaspoons of instant coffee to a mug
- Dissolve the coffee with a tablespoon of cold water
- Pour the hot water into the mug
- Mix in sugar or spices, if desired
- Add milk or cream if you’re not a fan of black coffee
- Stir your coffee and serve

As you can see from the above example, an algorithm is not a complicated term. And there seems to be an algorithm for accomplishing almost any task.

**If you write down a step-by-step set of instructions that shows how you prepare for work or school daily; that’s an algorithm. **

The concept of an algorithm is quite simple but not all algorithms are as simple as “how to make a coffee at home” or “how you prepare for work daily”.

There are also computer algorithms that are somewhat complicated, especially advanced ones.

Heck!

Algorithms kind of remind me of algebra.

Wait a minute!

Do you know that the terms algorithm and algebra spring up from the same source?

Yep!

**The term algorithm dates back to 900 years ago.**

## Brief History of Algorithm

In the 9th century, a great mathematician called, Muhammad Ibn Musa Al-Khwarizmi, lived famously in Persia.

He was appointed as the head of the House of Wisdom (an intellectual center for scholars) around 820 AD, in Persia (present-day Bagdad).

Al-Khwarizmi was a scholar who produced works in mathematics, geography, astronomy, and cartography.

One of his influential books titled “Concerning the Hindu Art of Reckoning”, was discovered 300 years later after the work was produced. And it was translated into Latin.

When his name **“Al-Khwarizmi”** was Latinized in the title of the Latin version of the book, it became **ALGORITHMI**.

Alas!

The origin of the word ‘Algorithm’ and ‘Algebra’ was also another word originating from the work of Al-Khwarizmi or should I say ‘Algorithmi’.

Algorithmi’s or Al-Khwarizmi’s works revolutionized western mathematics greatly. So great was his influence in western mathematics, that the current numbering system in the west (0, 1, 2, 3, 4, 5, 6, 7, 8, 9) was introduced by the works of Algorithmi along with the decimal points, among other things.

The word ‘algorithm’ gradually slipped its way into the English words around the 13th Century and in the 19th Century, it became known as a step-by-step set of information for accomplishing a specific task.

That was how algorithms came to be known as algorithms, thanks partly to Al-Khwarizmi or Algorithmi in Latin.

## Algorithms in Everyday Life

Algorithms are everywhere today, even as we breathe, literally. If you take the time to look around you now (like right now), you are bound to note some algorithms in execution.

There are billions of algorithms running in our everyday lives. Here are examples of algorithms in Everyday Life:

- Recipes (a recipe is a set of instructions for preparing a particular dish and that makes it an algorithm)
- Instruction manuals
- Travel Direction Guides (turn left after you pass the MacDonald)

You can spot lots of algorithms in play, if you become more observant of your environment (everything within and without) and take detailed step-by-step records of every happening.

## Mathematical Algorithms

Mathematical algorithms are a set of rules for solving a specific mathematical problem.

Algorithms have for long been the pillar of mathematics. Without really going deep or becoming too nerdy, just think about how we add, subtract, divide, and multiply numbers, it’s by following an algorithm (2 + 2 * 2 – 2 = 4).

With mathematics, there is always a set of rules (algorithms) to flow in order to solve problems.

Mathematical algorithms have been in existence since antiquity. Ancient Babylonian and Egyptian mathematicians use arithmetic algorithms such as algorithms for solving division, for solving basic arithmetic problems.

Ancient Arabic mathematicians used cryptographic algorithms for code breaking and the popular Euclidean algorithm was used for finding the greatest common divisor of two numbers.

**Algorithms are everywhere indeed.**

## Computer Algorithms

Computer algorithms also known as computer programs are a set of instructions written in a computer language that shows/tells a computer how to accomplish a task.

They are simply, algorithms written in languages a computer can understand (computer language).

When a computer algorithm is executed, a task is accomplished.

Algorithms ushered in computers, and that’s what a look back in time tells.

Computers are nothing but electromagnetic devices that performs task based on the execution of algorithms. And their existence today, was in part credited to Charles Babbage, the father of computers.

Babbage was the historic man who invented the first mechanical computer called the “analytical engine”. Though he didn’t complete its construction, the essential ideas of modern computers were found in the Analytical Engine.

In his invention of the Analytical Engine, Babbage originated the concept of a digital programmable computer and that’s simply how computer algorithms came to be.

**The idea was simply to make machines accomplish tasks by making them follow a set of well-defined instructions (algorithms). **

Fast forward past the days of Alan Turin, the supposed father of modern computers. Computers became more useful/helpful as they became programmable (being able to follow algorithms).

Technological advancement which relation to computers has really been about our ability to give computer systems more advanced algorithms. And of course, increasing and improving its ability to execute the algorithms speedily.

## Examples of Computer Algorithms

There are many examples of computer algorithms, ranging from the simple to the complicated, and from the outdated to the cutting edge.

Here are a few examples of computer algorithms:

- Word processors
- Calculators
- Machine Learning Algorithms
- Computer Aided Design programs
- Spreadsheets

## Flowchart

It will be somewhat incomplete to explore the concept of an algorithm without cutting across flowcharts: It’s like the two are destined for each other.

Flowcharts in General, are diagrams that depict a process. They became widely associated with computer algorithms as they were used to represent computer algorithms using diagrams.

Flowcharts help a layman to understand by diagrams how a computer algorithm works.

## Types of Algorithms

Algorithms, in general, have different structures, basically, there are three different structures. And they are classified as such. Below are the three types of Algorithms:

- Sequential Algorithms
- Loop Algorithms
- Selection/Condition Algorithms

## Sequential algorithms:

These are the most popular and simple types of algorithms.

**Sequential Algorithms are a set of rules for accomplishing a specific task. They are executed following a step-by-step approach directly. **

Note the word ‘**directly**’ in the aforementioned definition because that’s what makes sequential algorithms unique.

Say there are 7 steps to accomplishing the task of making a coffee, and these steps are structured as a sequential algorithm.

In order to execute this algorithm, you will have to follow **step 1 – step 7 directly** without having to repeat or jump a step in the process of execution.

Sequential algorithms are mostly adopted for structuring simple algorithmic problems.

## Loop Algorithms:

** These are set of rules/instructions for accomplishing specific tasks, following well-defined repeated steps. With the loop algorithm, the keyword to look out for is “well-defined repeated steps”. **

Loop algorithms are unique because of the introduction of loops (well-defined repeated steps in an algorithm) to turn the complex sequential algorithmic problems into simple algorithms. This is the case when a series of steps are repeated in an algorithm.

One example of a loop algorithm is the algorithm of ‘walking’. To write down this algorithm sequentially, it will look like the following:

**Step I:** Move your left leg forward

**Step II:** Move your right leg forward

**Step III**: Move your left leg forward

**Step IV**: Move your right leg forward

**Step V:** Move your left leg forward

**Step VI:** Move your right leg forward

**Step VII:** Move your left leg forward

**Step VIII:** Move your right leg forward

**Step IX:** Move your left leg forward

**Step X:** Move your right leg forward ……. and so on.

**You get the picture right?**

Writing an algorithm like this in sequentially will get the job done eventually but the writing process would be daunting.

But, this is a situation where loop algorithms flourishes.

If you look at the above walking algorithm, you will notice that steps I and II are simply just repeated over and over again. Using a loop in the above algorithm will be simple like the following:

**Step I**: Move your left leg forward

**Step II:** Move your right leg forward

**Step III:** Repeat Steps I and II

**That’s simply a loop algorithm.**

## Selection/Condition Algorithms:

These are types of algorithms where “user-defined” conditions are allowed or introduced within the set of instructions for accomplishing a specific task.

Algorithms are generally created to help accomplish a specific task, but with conditional algorithms, it’s kind of tricky.

Say, for instance, I intend to write an algorithm on how to make a coffee at home, and it dawns on me that coffee is either served hot or cold. What do I do?

Using a sequential algorithm, I may have to write two separate algorithms, one for a hot coffee and another for a cold coffee.

Obviously, doing so would be daunting, since, the difference between a hot or cold coffee lies in a small detail: The temperature of the water used, ice or no ice.

A simple way to solve this kind of problem algorithmically is to introduce conditions within the algorithms. As such, the algorithms for making a hot/cold coffee would look like the following:

- Heat up a cup of water
- Add 1 to 2 teaspoons of instant coffee to a mug
- Dissolve the coffee with a tablespoon of cold water
- If you want a hot coffee pour hot water into the mug,
**else,**for cold coffee pour cold water - Pour the water into the mug
- Mix in sugar or spices, if desired
- Add milk or cream if you’re not a fan of black coffee
- Stir your coffee and serve

Algorithms with conditions are usually expressed with the “if-else-then” statements. They are vital for writing algorithms where the executor (user) has the power to select options while executing the algorithm.

Conditional algorithms are simple; if a condition is true the output will be A, else, if it is false, the output would be B.

In more complex algorithms, it’s common practice to see the use of all three or two types of algorithms expressed within an algorithm. Complex algorithms are more about incorporating/linking different simple algorithms to achieve the desired output.

## Importance of Algorithms

The importance of algorithms cannot be over-emphasized. Algorithms are vital for defining how things work and making things work. Without algorithms, forget modern technology.

As a matter of fact, forget the universe, it will certainly not exist as it is without following diverse algorithms.

Here are some importance of algorithms:

- Algorithms help us execute tasks faster and more accurately.
- They are fundamental for building computer software/applications that have revolutionized our world for the better, saved lives, and made life generally better.
- The science of algorithms helps us make advancements in almost every aspect of life; science, technology, art, and so on.

## Wrapping Up

Algorithms are simple, yet, very important details about how things work. They are indeed in a simple term: a step-by-step set of instructions on how to accomplish tasks. They are everywhere.

A Latinized name of a great Persian mathematician has risen to prominence, becoming a buzzword and playing major roles in every industry.

What makes Facebook and Google Search so unique? Most people would say (among other things), that it’s the unique algorithms their systems execute.

Algorithms will play a great role in the future, owing to their role in Artificial Intelligence Development.

Your Alexa, Siri, and Google Assistant rely on amazing deep learning algorithms to be functionally intelligent.

Algorithms are undeniably important and they are everywhere, even in your breathing process.

**Checkout: Top Machine/Deep Learning Companies**

I’m a Tech Stock Analyst, with focus on companies developing cutting-edge techs. Keeping track of cutting-edge techs, companies and stocks is what I do almost everyday. And I love it. Whether it’s artificial intelligence, 5g, or autonomous vehicles; I’m all in.