# What are algorithms?

In computer science, algorithms are the set of systematic, pre-defined instructions used to perform a specific task. These instructions are in a specific order with steps to follow to achieve a goal.

Every algorithm has an input and output; in between, there are instructions or the sequence of steps to follow. These steps should be in order, and above all, they must be a finite set of operations that allow us to achieve a specific solution.

In the world of programming, every program or operating system works based on algorithms written in a programming language that the computer can understand to execute the steps or instructions automatically. In terms of big data and artificial intelligence, algorithms analyze information and data from consumers and end users.

## What characteristics do algorithms have?

Regardless of what an algorithm is used for, they all have the following characteristics in common:

1. Start and end: they start from an initial state from which they execute a set of instructions to reach a final exit or state of completion.
2. Accuracy: they must indicate a clear, specific, logical order of instructions for executing each step, without any room for ambiguity.
3. Sequence: they must follow a set of orderly, understandable, pre-defined steps.
4. Complete: they must take into account all the possibilities and presentations of the problem to execute the exact solution.
5. Finite: the number of steps to execute the task must be finite to complete it.
6. Abstract: they represent a guide or model for ordering processes.

## What types of algorithms are there?

According to their system of signs, or how the steps to be followed are described, the algorithms can be:

• Quantitative and qualitative: whether they operate based on mathematical calculations or logical sequences.
• Computational or non-computational: whether or not they require the use of a computer for solving or executing a certain task.

According to their function and strategy, or what they do and how they do it, there are five types of algorithms:

• Search algorithms: these find one or more elements with a set of properties within a certain data structure. Searches can be:
• Sequential: they compare the element to be found with each element of the set until it is found.
• Binary: these compare the item searched with an item located in the middle of an ordered series to determine if they are the same.
• Sorting algorithm: these are used to reorganize elements in a list following numerical or alphanumeric order guidelines. They can be:
• Bubble: these compare each item in the list to be sorted, swapping positions if they are not sorted correctly.
• Selection: these sort elements from smallest to largest consecutively.
• Fast: one element is chosen from the set, and the rest are repositioned around it, depending on whether they are smaller or larger with respect to it.
• Voracious algorithms: a type of algorithm applied to optimization problems used for logical decision-making to arrive at a global final solution. These algorithms are not reversible once the decision is made to run them.
• Dynamic programming: this type of algorithm is associated with the method with which the result is processed. An element’s solution depends on solving a set of smaller problems, so as subproblems are solved, the solutions are stored so that they don’t need to be calculated again. With dynamic programming, the execution time for the algorithm is reduced.
• Probabilistic algorithms: this type of algorithm bases its results on chance so that a good solution can generally be found for any random distribution of inputs. Chance means optimizing time with respect to whether the best alternative for each individual case would be determined. As a result, a good solution to a problem is obtained for any input data distribution.