What is an algorithm?


  • Previous knowledge
  • And now, what is an algorithm?
  • And what are algorithms for?
  • Extra: Algorithm representation techniques

Previous knowledge

Before explaining what an algorithm is, it is necessary to mention several programming concepts that, although theoretical, will help us to understand each other among programmers and make a detailed explanation that can be understood.

  • The most basic form of programming with sense is called an Instruction or Rule, we could say that it is one or several lines of code that form a logic and represent one or several programming commands.

And now, what is an algorithm?

Given a problem P, an algorithm A is a set of rules or instructions, which define how to solve P in a given time. Or we can see it as a set of instructions that, carried out in order, lead to the solution of a problem. So we conclude that an algorithm is our proposal to develop a solution to a problem, in our case, it will be a solution to a problem that can be solved by software.

Algorithms have a series of characteristics for their proposal to be valid:

  1. It must be precise and indicate the order of realization step by step, that is, it must be clear what it does, for this a graphic representation is usually used
  2. It must be defined, if it is executed two or more times, before the same input it must obtain the same result. This means that we must cover all the possibilities of the problem successfully and resulting in the same logic.
  3. It must be finite, it must have a certain number of steps.
  4. It can have zero or more input elements. It means that you can consider using external values ​​that will be defined in the algorithm and will define in some way the behavior of the algorithm.
  5. It must produce a result. In the case of programming, it may be data or changes in the previous state in which the software or system was found.

And what are algorithms for?

Having seen that it is an algorithm, now the question arises as to what it is for, what is its purpose in the world of programming? Well, it is neither more nor less than the step prior to the development of a software program, that is, it is like the plan of a building that will be built later.

A program is an algorithm written with a precise notation (programming language) that can be executed by a processor.

Extra: Algorithm representation techniques

For the representation of an algorithm, before being converted to a programming language, written, graphical or mathematical notations are usually used. The most common methods are:

  • Free diagramming (Flow diagrams).
  • pseudocode.
  • Natural language (Spanish, English, etc.).
  • Mathematical formulas.

Leave a Reply