What is an algorithm? Concept, Parts, Types and Examples

What is an algorithm?

We explain what a computer algorithm is and what it’s for. Characteristics and parts of an algorithm. Practical examples.

What is an algorithm

Basically, an algorithm is used to solve a problem step by step.

In computing, an algorithm is a sequence of sequential instructions, thanks to which certain processes can be carried out and certain needs or decisions responded to. These are ordered and finite sets of steps, which allow us to solve a problem or make a decision.

Algorithms have nothing to do with programming languages, since the same algorithm or flowchart can be represented in several programming languages, i.e. it is a pre-programming arrangement.

Seen in this way, a program is nothing more than a complex series of algorithms ordered and codified by means of a programming language for its later execution in a computer.

Algorithms are also common in mathematics and logic, and are the basis for the manufacture of user manuals, instruction booklets, etc.

Its name comes from the Latin algoritmus and this surname comes from the Persian mathematician Al-Juarismi.

One of the best-known algorithms of mathematics is the one attributed to Euclid, to obtain the maximum common divisor of two positive integers, or the so-called “Gauss method” to solve systems of linear equations.

Parts of an algorithm

Every algorithm must consist of the following parts:

  • Input or input. The input of the data that the algorithm needs to operate.
  • Process This is the formal logical operation that the algorithm will undertake with the input received.
  • Output or output. The results obtained from the process on the input, once the execution of the algorithm is finished.

What is an algorithm for?

Simply put, an algorithm is used to solve a problem step by step. A series of ordered and sequenced instructions to guide a given process.

In computer science, however, algorithms constitute the skeleton of processes that will then be coded and programmed to be performed by the computer.


There are four types of algorithms in computing:

  • Computational algorithms. An algorithm whose resolution depends on the calculation, and which can be developed by a calculator or computer without difficulties.
  • Non-computational algorithms. Those that do not require the processes of a computer to be resolved, or whose steps are exclusive to human resolution.
  • Qualitative algorithms. This is an algorithm whose resolution does not involve numerical calculations, but logical and/or formal sequences.
  • Quantitative algorithms. On the contrary, it is an algorithm that depends on mathematical calculations to find its resolution.

Characteristics of the algorithms

An algorithm must deliver a result based on its functions.

The algorithms have the following characteristics:

  • Sequential. The algorithms operate in sequence, one must be processed at a time.
  • Precise. Algorithms must be precise in their approach to the subject, i.e. they cannot be ambiguous or subjective.
  • Ordained. The algorithms must be established in the precise and exact sequence so that their reading makes sense and the problem is solved.
  • Finite. Any sequence of algorithms has to have a certain end, it cannot be prolonged to infinity.
  • Concrete. Every algorithm must give a result based on the functions it fulfills.
  • Defined. The same algorithm before the same input elements must always give the same results.

Examples of algorithms

A couple of possible examples of algorithm are:

Algorithm for choosing party shoes:

  1. HOME
  2. Enter the shop and look for the men’s shoe section.
  3. Take a pair of shoes.
  4. Are those party shoes?

    YES, I DO: (go to step 5) – NO: (back to step 3)

  1. Is it the right size?

    YES, I DO: (go to step 6) – NO: (back to step 3)

  1. Is the price payable?

    YES, I DO: (go to step 7) – NO: (back to step 3)

  1. Buy the chosen pair of shoes.
  2. END

Algorithm for calculating the area of a right triangle:

  • HOME
  • Find the measurements of the base (b) and height (h)
  • Multiply: base by height (b x h)
  • Divide the result by 2 (b x h) / 2
  • END

You may be interested:

How to make Wi-Fi more powerful and faster 

How to make me up for a wedding Advice and recommendations for brides

Connect your Android to your PC 

Joining Two Partitions into One