What is an algorithm? Characteristics and Types
The belief is that algorithms are used only in matters related to mathematics. Nothing more wrong!
Although the term is very present in this area, computing and other areas related to numbers, algorithms are used much more than we think, and in all aspects of our daily lives.
What will you find here? What is an algorithm in computing? Concept, characteristics and types. His story. Practical examples.
If you want to see how algorithms are related in practically all aspects of our life , we invite you to continue reading the article until the end.
What is an Algorithm?
An algorithm allows us to carry out a task or find the solution to a certain problem through a flow of well-defined and structured instructions , which must also be in order, and be finite, that is, to have a solution or several possible solutions.
Once an initial state and an input are defined, if we follow the formulated instructions we will reach the final state and find the solution to the problem or achieve the defined objective.
Algorithm concept
The term algorithm comes from the classical Arabic language “ḥisābu lḡubār”, later transformed into Latin “Alborarismus”, which according to experts could be translated as “calculation using Arabic figures”. The origin of the word dates back to the Middle Ages, more precisely from the hand of the mathematician Al_ Khwarizmi, in an area of Central Asia today known as Uzbekistan, in Central Asia.
The algorithm is an ordered series of processes or steps that must be carried out to reach the solution to a specific problem. The algorithms can be of different types, those of daily life such as following the instructions to brush your teeth, start a washing machine, to solve or carry out more complicated processes such as the operation of a computer program.
One of the characteristics of algorithms is that they allow us to define a series of steps to follow that must be carried out to achieve the result we want, that is, a predictable result. At this point it is worth highlighting an example of the use of algorithms : computer software, which consists of precise instructions to carry out a procedure in the same way, but written in a programming language.
However, the use of algorithms is not limited to computers or automated systems, since algorithms are also well present in nature and in our lives. Basically, any task that must be carried out by means of instructions and rules defined for them could be considered as an algorithm. An example of this would be washing hands and similar tasks, as we can see further down in this post.
Types of algorithms
In simple terms to understand, there are two types of algorithms. The first are the so-called “conventional algorithms”, which are those that people perform every day in their daily events, in order to achieve a certain goal, such as making breakfast, or to solve problems in their working hours, such as programming what you will have for lunch based on the time you have available or calculating to what temperature the room thermostat should be raised.
Although it may seem too simple, the truth is that if we take the meaning of algorithm, which basically dictates that it is a “logical and finite sequence of steps that allows solving a problem or meeting a certain objective” any of the cited examples they conform as closely as possible to the meaning of algorithm.
The other type of algorithms are the so-called “computational algorithms” , which are those used by applications and computer software to perform the tasks we ask them or the automatic actions performed by the devices without our request. Again if we take the definition of algorithm, we see that all the required conditions are met.
It should be noted at this point that all arithmetic and algebraic operations related to algorithms are included in a science called Algorithmy. If we want to know more about computational algorithms, we invite you to continue reading the rest of the post, where you will find important definitions on the subject.
History of algorithms
Although most of us think that the implementation of algorithms is a fact more related to the appearance of modern computers, the truth is that in ancient times they were used to solve mathematical problems such as square roots and multiplications.
In this sense, the Egyptians and Babylonians already used algorithms, even though neither the theoretical basis nor the concept of algorithm as such existed yet , the former being those who used algorithms very similar to those of binary expansion.
The word algorithm has its origin in the Arabic term Al-Khwārizmī , derived from Quitab Al Jabr Al Mugabala, which is the name by which an important astronomer and mathematician was known who in the 9th century left as a legacy numerous treatises about concepts about zero and Hindu numeration, and in which he also dealt with topics such as the development and resolution of equations of the first and second degree with a limited number of processes. These treatises were very helpful in developing sentences for addition, subtraction, multiplication, and division of decimal numbers.
Although Al-Khwārizmī was not the creator of the first algorithm, since as we mentioned already the Egyptians and Babylonians used them, although without knowing it, it is considered that the Arab mathematician was the first to use them with an order. But algorithms as we know and use them today were not used until well into the eighth century.
The most important leap in algorithms and their relationship with computing occurred in 1842, at the hands of Charles Babbage, with his analytical engine, and Ada Lovelace, creator of the first algorithm destined to be processed by a machine.
Unfortunately, Charles Babbage could not finish his analytical engine, therefore the algorithm created by Ada Lovelace could never be implemented. But the work carried out by both was of great inspiration for all the investigators who arrived later.
The other great leap in algorithms applied to computer science occurred a few years later, precisely in the year 1900, when the mathematician David Hilbert declared some fundamental considerations about the science of mathematics, which led to new points of view that later they would be of great importance for the development of new technologies, such as the work carried out by scientists such as Alonzo Church, Alan Turing, Stephen Kleene or Emil Post.
Finally, the 1950s and 1960s saw the birth of many programming languages, compilers, and operating systems , which brought us to where we are today, all thanks to centuries of work done by mathematicians and scientists around algorithms.
Alan Turing and the algorithms
The British scientist Alan Turing (1912-1954), was the generator of the concepts of algorithm and computation: the famous Turing machine. Turing is known, in the field of artificial intelligence, for being the creator of the Turing test, by which it is possible to judge the intelligence of a machine, analyzing whether its responses are impossible to distinguish from those of a human being.
Thanks to their contributions, it was possible to develop current programming and computing. In one of his works he deduced that there are several things that algorithms cannot solve: Is it possible for an algorithm to calculate whether a computer program will “hang” at some point? or will it keep running forever? The answer is: No. Turing, back in 1936 he proved that such an algorithm cannot exist. He wrote that there is no way to consistently predict the “crash” of a computer. Nor is it possible to avoid it.
Euclid’s algorithm
In mathematics, Euclid’s algorithm is an efficient method to calculate the greatest common divisor of two integers , also known as the greatest common factor or the greatest common divisor.
It is named after the Greek mathematician Euclid, who described it in Books VII and X of his Elements. In its simplest form, Euclid’s algorithm starts with a pair of positive integers and forms a new pair consisting of the smallest number and the difference between the largest and smallest numbers.
The process is repeated until the numbers are equal. That number then is the greatest common divisor of the original pair. The oldest surviving description of the Euclidean algorithm is found in Euclid’s Elements, making it one of the oldest numerical algorithms still in common use.
Computational algorithm
We have all heard the word “Algorithm” related to computer science, as for example when talking about the “Google algorithm” or the “Facebook algorithm”. This is because nothing happens in computing without a diagram that defines a series of steps, which definitely make up an algorithm.
In this sense, the computer algorithm is the fundamental element of any computer program, and is not related to the programming language used to develop it, but to the steps that must be carried out to achieve the objective, that is, the set of instructions and steps developed to carry out the task entrusted to the software.
This in a nutshell means that the software developer must first design the flow chart, write the algorithm, and then translate it into the programming language that best suits their own needs and customer requirements. With this, the computer engineer ensures they have a solid base from which to start creating a methodology with well-defined and finite scenarios, that is, they must end at some point in their journey.
Basically the use of an algorithm in computing offers us the possibility of finding a generic solution to a certain problem, and it will allow us to reuse it every time it is necessary to achieve the desired objective.
We recommend you read this report on algorithms in programming
Characteristics of an algorithm
Up to this point we have talked about the different types of algorithms and their origins, but we need to know one more important point, which are the fundamental characteristics that every algorithm must meet. That is why below these lines we will find the fundamental points that a process must meet to be considered a true algorithm.
- The first thing we must consider is that an algorithm must be precise : that is why the exact order of execution of each step involved in the process must be indicated.
- Another important point to consider is that an algorithm must be perfectly defined. This means that in the case of executing the same more than twice, the same result should always be obtained regardless of the number of times it is followed.
- It is also necessary to know that an algorithm must be finite, that is to say that the algorithm must culminate at some point in its execution, expressed in other words, it must have a number of well-determined steps until the end of its task.
- Also, an algorithm has to be readable. This means that the text you describe must be clear and concise, in a way that allows immediate understanding, that is, without elaborate or unclear procedures.
- Finally, an algorithm must be defined in three fundamental parts, which are: Input, Process and Output. If you want to know more about this topic, you will find information about it later in this post.
Characteristics of computational algorithms
Originally, the idea of taking this concept from the field of mathematics to the field of incipient computing was proposed by the English mathematician Alan Turing, who laid the foundations to define the basic elements of an algorithm applied to computer science, which they should be the following:
- A limited sequence of steps, which must be clearly defined. Also these steps must be independent of each other.
- An agent, who in some cases can be a human operator and in other cases part of the program itself, is the actor whose task is to apply each of the stages of the process at a specific point along the way.
- This agent must have the ability to interpret operational instructions and simultaneously have the ability to store the information provided by the program itself.
- The result obtained when certain operations of the program are carried out must always behave the same, in each step of the operation, taking into account of course the configuration of the initial input data.
- The operation should always end with a concise result .
At this point, it should be noted that there are cases in which the procedure requires that a specific result be offered, and other cases in which it is not necessary. That is why repetitive or irregular algorithms that do not culminate are so common in computer application programming.
The best example of this is modern operating systems such as Windows, Linux or the OS of Mac computers, which must continue to run to allow the other applications and processes of the computer to continue to fulfill their function or task.
Parts of an algorithm
From this point on, we will know the basic rules of the parts that must make up an algorithm to be considered as such. Basically, algorithms must be composed of three main parts that are input, process and output, regardless of whether they are computational algorithms, non-computational algorithms, qualitative algorithms or quantitative algorithms.
Here below we will find the characteristics that each phase of an algorithm must have.
Entry
This phase of the algorithm corresponds to the input values that must be fed to it. Basically it is the information that is delivered to the algorithm, that is, the data values with which it will have to offer a certain result.
Process
The second phase of an algorithm occupies the necessary calculations to process the data with which we have fed the algorithm, that is to say that at this point the information delivered to the input of the algorithm will be processed, and with which the expected result must be reached.
Exit
The third and last phase of an algorithm is where the result of the operation is obtained, that is, the transformation of the data that was provided in the input phase and developed in the process phase.
How to make an algorithm
In the event that we need to make our own algorithm to be able to solve problems or improve a process in our activity, we can carry it out quite simply, since all we have to do is make it clear what we need and how we can solve it.
For this we must carry out the series of necessary steps and their derivations to be able to reach the expected result of the problem at hand. The steps to define and specify our algorithm are the following:
- First step: Prior analysis of the problem or need. The first thing we have to do, before starting with the development of any algorithm, is to carry out a detailed analysis of the situation or problem.
- Second step: Define the requirements. In this step, we must define exactly the problem we have to solve and break it down, including all the derivations that may arise.
- Third step: The identification of the modules. In this step, clearly identifying the modules is as important as identifying the requirements. This is so because correctly identifying the modules will help us to considerably simplify the implementation of the correct algorithm steps for our problem, and that we have identified in the previous step.
- Step Four: Creating the algorithm. At this point we must ensure that the algorithm meets all the appropriate requirements to carry out the entrusted function. This is similar for both non-computational algorithms and computational algorithms. In the case of a computational algorithm, it must also meet certain characteristics in order to be able to later be implemented in any programming language.
- Fifth step: The implementation of the algorithm. In the chaos of computational algorithms, their implementation must be carried out by translating it into a programming language so that any computer can interpret its instructions and send the necessary information to its hardware to complete the steps. corresponding and thus obtain the expected result.
- Sixth step: Creation of the tools to carry out the algorithm. In the latter, and if we were able to correctly complete all the previous steps, we will be in a position to create the necessary tools to be able to execute the developed algorithm. In the case of a computational algorithm, we can develop an application through any programming language to be able to carry it out, which will have a series of instructions that, ordered one after the other, will be able to represent the algorithm that we have designed and be able to offer a solution to the identified requirements. In cases where it is a non-computational algorithm, we can develop the necessarytaking into account the steps that the algorithm must follow, such as a production line.
Examples of algorithms
Algorithms can be applied in any field, and they are not at all foreign to daily life, that is, they are not only calculations that are applied in certain scientific fields, since in our daily life we can find dozens of examples of algorithms, which most of the time they go unnoticed by all of us.
Below we are going to present you an example of an algorithm. We recommend you enter the following link to see a wide variety of algorithm examples , where you can understand how they are applied in daily life.
An example of an algorithm in daily life is the digestion process, which is basically an algorithm concept that we live with every day without implicitly having to know its definition for it to occur. This means that in order for us to carry out the digestion process every day, it is not necessary for us to know how it works or the actors involved in the procedure.
Algorithms are run countless times a day, but we have gotten used to them or perhaps we just don’t know that they are, because we are not familiar with the concept of algorithm.
One fact that we must highlight is that the algorithms in daily life do not differ too much from the algorithms used in computer science. In the following example, we propose to compare the algorithm described with some given situation in real life. We assure you that the result will surprise you!
For the example we have made an algorithm where it is determined if a person can enter a mechanical attraction in an amusement park.
Start | |
Step 1 | Write “What is the age?” |
Step 2 | Read “Age” |
Step 3 | Write “What is the height? |
Step 4 | Read “Height” |
Step 5 | If (“Age”> = 18 “Height”> = 148) then |
Step 6 | Write “You can enter” |
Step 7 | Otherwise “yes no” |
Step 8 | Write “Can’t enter” |
Step 9 | Completion of ” Yes” |
FINAL |