What are Algorithms, their types, and how to learn them
Algorithms are one of the basics of Computer Science that programmers and computer engineers study during their academic or self-learning studies, a term that no specialist or even an ordinary person can overlook.
These algorithms have become an indispensable part of our
lives. For example, we often hear now about the social media algorithms that
process the content that we publish on our account, or the search engine
algorithms that show and arrange search results.
In this article, dear reader, we will provide you with
everything you need to know about algorithms, starting with their definition,
history, types, and how they work. We will provide you with a list of the most
important and best international courses that enable you to learn algorithms.
What are Algorithms?
Algorithms are a set of explicit steps that are applied in
order to reach a result or solve a problem. Simple definition right?
This definition may seem too simple to you, but on the
contrary, it is never like this. This is the definition agreed upon by
specialists and academics.
Algorithms can be simplified or likened to recipes for
eating, through which you will transfer the materials you have through a set of
steps to the meal that you will eat.
This is the core of defining algorithms, no matter how easy
or complex they are, whether they are related to trading or financial markets,
or used in hospitals and treatment, or even used to run rockets into space.
For some details on this matter, the algorithms consist
of:
1- The problem or question is described in a mathematical
way that a computer can understand.
2- A mathematical formula or set of clear steps for dealing
with a condition.
3- A method of entering problem data to apply the formula or
steps to it.
4- Execute those steps or formula accurately and smoothly.
5- Obtaining the required output from the previously entered
inputs or data.
We will talk shortly about how the algorithm works using a
simple and easy example that shows us how it works.
In general, algorithms are the magic way that made our lives
so easy, as they save a lot of time, effort, and money, and they are more
effective and accurate than the human factor and faster by tens and hundreds of
times.
History of algorithms
Of course, you would have thought that algorithms and its
singular algorithm is a standard Arabic word, or at least close to the Arabic
language, and this is true, as Arab scholars were the first to come up with its
form that we know now.
The word algorithm or algorithms comes from the name of the
Arab scholar Muhammad bin Musa al-Khwarizmi. Who 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 the science of algebra and he
is the founder of it as we know it today, because of which the algorithms were
called algorithms because they depend heavily on it in their work.
After this strong Arab beginning, the West translated this
knowledge, developed it, and absorbed it into their civilization and later
scientific achievements.
For example, in the nineteenth century, Ada Lovelace
discovered that algorithms could be applied and implemented by machines, thus
opening the door to the algorithms we use today.
And in the twentieth century, the genius scientist Alan
Turing applied its concept through the Turing machine, which made the machine
actually use an algorithm in the real world, thus opening the door to computing
and artificial intelligence as we know it today.
How do algorithms work?
The way algorithms work is very easy, no matter how
different an algorithm is from its counterpart, as it is inputs, on which some
calculations or steps are made until the required outputs are obtained.
In order to simplify the way the algorithms work, let's
think about the algorithm through which we choose the clothes we wear, and how
we explain to a young child how to choose the clothes that he wears 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
timing at which it will go out.
Through these inputs we will process the clothes we have,
and then we will then choose the most suitable clothes we have that we can
wear.
In general, there are dozens and hundreds of factors that
you can take into account other than that, such as the possibility of rain, the
nature of the activity that you will do, the clothes that the people you will
meet wear, and so on.
The higher the numbers of these inputs, the more complex the
algorithm, and thus the accuracy of its results and the more intelligent and
efficient it is in performing its task.
After obtaining all the required inputs, the processing or
steps used will come here, which are known in technical algorithms as
Computation.
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 suit the current weather or climate.
So after a long process of eliminations depending on your
input, you'll be left with fewer options to dress up with.
You will then have to try to reach the greatest consistency
between these clothes in order to have a suitable suit to go out with.
In the end, after you reach this solution, this command will
be called Outputs, which is the final output that we wanted to get from the
beginning.
This is a simple algorithm, and if we want to talk about
smarter algorithms, such as those of machine learning, deep learning, or
natural language processing (NLP), we will increase the complexity a bit.
It will feed your algorithm a lot of data and information as
input, such as: your past experiences choosing clothes or how you felt about
these clothes during the previous times you wore 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 choose the best suit to wear.
Types of algorithms
There are very 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 call and
repeat themselves until the problem is solved and the final result is reached.
2. Dynamic programming algorithms: These algorithms
are somewhat complex, and are used to solve more complex problems, and they are
widely 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 experimenting with 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 this choice later.
6. Divide and conquer algorithms: These algorithms
first divide the problem or data into smaller parts, then work on solving it
and then collect it.
7. Brute Force Algorithms: This algorithm is one of
the simplest algorithms ever, as it performs experiments. 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, there
are some algorithms that are used frequently, such as:
Search Algorithms: These algorithms are widely used,
involve several algorithms, and are generally used, as their name suggests, to
search for a specific value or thing among the data.
It contains a lot of 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 very
popular, and they have many types.
Dijkstra algorithm: This algorithm is used to quickly
find the shortest path or distance between two points.
Bell Man Ford Algorithm: It is an algorithm used to
find the shortest line between two points, especially in graphs with negative
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 many steps and complex algorithms, we can make it perform
surgery or fly a plane on its own.
Algorithms shorten a lot of time for us, 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 that we do, and make it take care of the 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. In the end, they solve the problem or reach the required
result correctly, otherwise they are not defined as an algorithm, and thus we
guarantee their extreme effectiveness.
At this time, algorithms are witnessing a great deal of
interest by technical specialists and computer scientists. There are entire
disciplines related to the analysis, improvement, and invention of algorithms.