What is an Algorithm?

An algorithm dictates, logically and systematically, how a problem or a class of problems should be solved. It consists of a finite number of individual instructions. The first algorithm intended for a computer was recorded in 1843 by Ada Lovelace.

A computer program is an algorithm that is written in a programming language. As computer programs or electronic circuits, algorithms control computers and machines, for example – they give the commands for all digital processes.

A well-known example of the application of an algorithm is the Rubik’s Cube. There are 43,252 trillion different possibilities for its solution. An algorithm can define clear steps that should be taken in a particular situation in order to arrive at the best solution. The term algorithm here means the recommended action for the various decision-making situations. For Rubik’s Cube, the best solution is always the fastest solution.

An algorithm therefore consists of a series of individual steps. These can be implemented in a computer program for execution, but they can also be formulated in human language.

Every algorithm must have the following properties:

  • An algorithm must be determined , it must deliver the same output every time it is executed with the same input.
  • An algorithm must be deterministic , at every point in time when it is executed, the next calculation step (based on the intermediate results) is clearly specified.
  • An algorithm must be finite , its source code must consist of a limited number of characters and at it should take up a limited amount of memory space.
  • An algorithm must be terminated , which means that for every (accepted) input it comes to a result after a finite number of steps or it breaks off in a controlled manner (no endless loop).
  • An algorithm is effective , each instruction of an algorithm serves a specific and meaningful purpose in order to get closer to the ultimate output.

Algorithms are widely used in all areas of computer science. A search engine algorithm, for example, accepts search strings made up of keywords and operators as input, searches the associated database for relevant web pages according to its definition and returns results.

The word “algorithm” comes from the 9th century and is derived from the name of the Persian mathematician Al-Chwarizmi. The oldest known non-trivial algorithm is the “Euclidean algorithm”. It can be used to calculate the greatest common divisor of two natural numbers.