Themes

What is Computer algorithm?

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

  1. What is an algorithm?

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

The algorithms do not have to do with programming languages , since the same algorithm or flowchart can be represented in different programming languages , that is, it is an ordering prior to programming .

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

Algorithms are also common in mathematics and logic , and are the basis of making user manuals, instruction booklets, etc . Its name comes from the Latin algorithmus and this last name of the Persian mathematician Al-Juarismi. One of the best known algorithms of mathematics is that attributed to Euclid, to obtain the greatest common divisor of two positive integers, or the so-called “Gaussian method” to solve systems of linear equations.

  1. 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.
  1. What is an algorithm for?

Simply put, an algorithm serves to solve a problem step by step . It is a series of ordered and sequenced instructions to guide a particular process.

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

  1. Types of algorithms

There are four types of computer algorithms:

  • Computational algorithms . An algorithm whose resolution depends on the calculation, and which can be developed by a calculator or computer without difficulties.
  • No computational algorithms . Those who do not require the processes of a computer to resolve, or whose steps are exclusive to the resolution by a human being .
  • Qualitative algorithms . It 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.
  1. Characteristics of the algorithms

computer algorithm
An algorithm must offer a result based on its functions.

The algorithms have the following characteristics:

  • Sequential . The algorithms operate in sequence, must be processed one at a time.
  • Accurate . The algorithms must be precise in their approach to the subject, that is, they cannot be ambiguous or subjective.
  • Ordered . The algorithms must be established in the precise and exact sequence so that their reading makes sense and the problem is solved.
  • Finite . Every sequence of algorithms must have a specific purpose, it cannot be extended to infinity.
  • Concrete . Every algorithm must offer a result based on the functions it fulfills.
  • Defined . The same algorithm before the same input elements must always give the same results.
  1. Algorithm Examples

A couple of possible examples of algorithm are:

Algorithm to choose some party shoes :

  1. START
  2. Enter the store and look for the men’s shoes section.
  3. Take a pair of shoes.
  4. Are they party shoes?

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

  1. Are there the right size?

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

  1. Is the price payable?

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

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

Algorithm to calculate the area of ​​a right triangle :

  • START
  • Find the measurements of the base (b) and height (h)
  • Multiply: base by height (bxh)
  • Divide the result by 2 (bxh) / 2
  • FINISH

Leave a Reply

Your email address will not be published.

Back to top button