# What are Algorithms, their types and how to learn them

There are a lot of buzzwords that are always used in technical and computing circles, such as: Machine Learning, Data Science or Algorithms, and the latter is what we will talk about today.

Algorithms are one of the basics of Computer Science that programmers and computer engineers study during their academic studies or self-learning, a term that no professional, not even the average person, can overlook.

These algorithms have become an indispensable part of our lives, for example, we often hear now about social media algorithms that process the content we publish on our accounts, or search engine algorithms that show and rank search results.

In this article, we will provide you, dear reader, with everything you need to know about algorithms, starting with their definition, history, types and how they work, and we will list the most important and best international courses that enable you to learn algorithms.

### What are Algorithms

Algorithms are a set of obvious steps that are applied in order to reach a conclusion or solve a problem. Simple definition isn't it?

This definition may seem to you too simple, but on the contrary it is not at all, this is the definition agreed upon by specialists and academics.

Algorithms can be simplified or likened to eating recipes, in which you will convert the materials in your possession through a set of steps into the meal you are going to eat.

This is the definition of algorithms, no matter how easy or complex they are, whether they are related to trading, financial markets, used in hospitals and treatment, or even used to steer up rockets into space.

#### For some details on this matter, the algorithms consist of:

The problem or question is described in a mathematical way that a computer can understand.

A mathematical formula or set of obvious steps for dealing with a case.

A method for entering problem data to apply the formula or steps to it.

Executing these steps or formula accurately and smoothly.

Obtaining the required output from the input or data previously entered.

We will talk shortly about how algorithms work using a simple and easy example that shows us how they work.

In general, algorithms are the magic way that made our lives so easy, they save a lot of time, effort and money, and they are more effective and accurate than the human factor and tens and hundreds of times faster.

### History of Algorithms

Arab scientists are the first to reach the form that we know now.

The word algorithm or algorithms comes from the name of the Arab scientist Muhammad ibn Musa al-Khwarizmi; He was one of the most brilliant Arab scientists in the field of mathematics, in addition to his contributions to many other sciences, such as astronomy, geography, and others.

Al-Khwarizmi is the father of algebra and he is the founder of it as we know it today, which is why algorithms are called algorithms because they depend heavily on it in their work.

And you can watch this great short clip of why algorithms are called that from the BBC:

After this strong Arab beginning, the West translated this knowledge, developed it and absorbed it into their civilization and their scientific achievements later.

For example, in the nineteenth century, Ada Lovelace discovered that algorithms could be implemented by machines, and thus opened the door to the algorithms we use today.

In the twentieth century, the genius scientist Alan Turing applied its concept through the Turing machine, which actually made the machine using an algorithm in the real world, thus opening the door to computing and artificial intelligence that we know today.

### How do algorithms work?

The way the algorithms work is very easy, no matter how different any algorithm is from its counterpart, it is Inputs that some calculations or steps are performed on until getting the required Outputs.

To simplify the way algorithms work, let's think about the algorithm by which we choose the clothes we wear, and how we explain to a young child how to choose the clothes to wear based on them.

In the beginning, the Inputs will be the factors that we rely on in choosing these clothes, such as: the temperature in numbers or the summer / winter season, in addition to the occasion and its nature, and the time in which he will go out.

With these inputs we will process the clothes we have, and then we will choose the most suitable clothes we can wear.

In general, there are dozens and hundreds of factors that you can take into account other than those, such as the possibility of rain, the nature of the activity you will be doing, and the clothes that the people you meet are wearing.

The greater the number of these inputs, the greater the complexity of the algorithm, and thus the accuracy of its results and being more intelligent and efficient in performing its task.

After obtaining all the required inputs, here will come the role of the processing or the steps used, which are known in the algorithms as Computation.

At first, you will exclude clothes that are not suitable for this activity or events that you will attend, and then you will exclude clothes that do not fit the current weather or climate.

Thus after a long process of eliminations based on your input, you will be left with fewer options to wear.

You will then have to try to find the greatest harmony between these clothes in order to have a suitable suit for you to go out with.

Eventually after you get to this suit this will be called Outputs, which is the final output we wanted to get from the start.

This is a simple algorithm, and if we want to talk about smarter algorithms, such as those for machine learning or Deep Learning or Natural Language Processing (NLP) , we will increase the complexity a bit.

Your algorithm will feed a lot of data and information as input, such as: your past experiences choosing clothes or how you feel about these clothes during previous times you have worn them, and you can also include the experiences of others.

With this large amount of data, the algorithm will be able to be more efficient, and be very smart to make the best suit to wear.

### types of algorithms

There are so many types of algorithms that are used every moment around us, but we can say that there are 7 types that are the most important for algorithms:

#### 1. Recursive Algorithms:

Algorithms that invoke and repeat themselves until the problem is solved and the final result is reached.

#### 2. Dynamic programming algorithms:

These algorithms are quite complex, and are used to solve more complex problems, and are often used in complex matters, such as studying DNA in biology.

#### 3. Randomized Algorithms:

Algorithms that use random results and values.

#### 4. Backtracking Algorithms:

These algorithms solve large and complex problems by dividing them and trying to solve them repeatedly until the correct results are reached, so that the problem is solved backwards.

#### 5. Greedy Algorithms:

These algorithms work by thinking about the best move or action in the short term without thinking about the consequences of that choice later.

#### 6. Divide and conquer Algorithms:

These algorithms first break the problem or data into smaller parts, then solve it and then assemble it.

#### 7. Brute Force Algorithms:

This algorithm is one of the simplest algorithms ever, as it does the experiment. For example, if you want to find the 4-digit password of a user, you will try the 9999 possibilities until you reach the correct password.

In general, although there are hundreds and thousands of algorithms that are difficult or impossible for any programmer to learn all of them, there are some algorithms that are widely used, such as:

#### Search Algorithms:

These algorithms are widely used, and involve several algorithms, and are generally used as the name suggests in searching for a specific value or thing among the data.

It contains many types, such as: Linear Search, Binary Search, Exponential Search, Jump Search, and others.

#### Sorting Algorithms:

Algorithms that are used to arrange or rearrange data and values ​​in lists or arrays, and they are among the well-known algorithms such as the end, and they have many types.

#### Dijkstra:

This algorithm is used to quickly find the shortest path or distance between two points.

#### Bell Man Ford Algorithm:

An algorithm used to find the shortest line between two points, especially in graphs with negative side weights.

### The importance of learning algorithms

In the world of programming and computing, a specialist cannot fail to learn Algorithms, as they are the foundation upon which all modern technologies and inventions are based.

As you know, the computer only speaks the language of zero and one, but through the many steps and complex algorithms we can make it perform a surgery or fly a plane alone.

Algorithms save us a lot of time, so instead of wasting hours and even days on a task, algorithms can do the same task in a few minutes, especially with the development of computers.

It also saves money and effort, by using it we can automate the tasks we do, and make it take care of routine things so that we can use this time to deal with creative or more important matters.

One of the characteristics of algorithms is that they are limited and deterministic, as they eventually solve the problem or reach the desired result correctly, otherwise it is not defined as an algorithm, and thus we guarantee its extreme effectiveness.

And at this time algorithms are witnessing a lot of interest by technologists and computer scientists, there are whole disciplines related to the analysis, improvement and invention of algorithms.

### Best courses for learning algorithms

Fortunately, finding a source for learning algorithms is very easy, despite the difficulty and complexity of the topic itself, and this is because there are many people and sources that explain this topic in all languages ​​and ways.

You will find many books, courses, and YouTube lists that explain this important topic.

Among the best courses that I recommend to you are:

1. Introduction to Algorithms by MIT on YouTube

This course is well known. Like most MIT computer science and programming courses, this course is one of the most popular starting stations for amateurs to learn algorithms. The course, which dates back to 2011 and contains 47 lectures, has received more than 4 and a half million views.

I also strongly advise you to purchase the Introduction to Algorithms course reference to review it while studying this course or even alongside any other course.

2. Intro to Data Structures and Algorithms course offered by Google on the Udacity platform

This free and short course on Udacity has gained a lot of popularity lately and has been hailed as one of the best starting points for beginners, especially since it only takes 4 weeks and teaches algorithms using Python.

3. Algorithms Specialization on Coursera

This 4-course specialization on Coursera offered by Stanford University is one of the most popular stops for anyone who wants to learn algorithms.

At the end of the article, it must be emphasized that algorithms have completely changed the shape of our lives, and made us live in this amazing technical progress, and therefore they receive a lot of attention from professionals and computer scientists because of what they can offer us.

By : Mahmoud Ashour
Mahmoud ashour