# What is an Algorithm?

An algorithm includes finitely many steps to solve a given task. If the sequence of these operations is followed, the task will be solved subsequently in any case and the same results will always be delivered. Algorithms are widely used, especially in mathematics and computer science, because they can be used to solve complex problems easily and repeatedly.

### How is the term defined?

We encounter algorithms in more and more areas of everyday life. Although the term is primarily at home in computer science and mathematics, we also encounter the simplest algorithms in everyday life. The hand-washing instructions which have been posted on many public sinks since the Corona pandemic are also an example.

For everyday use, the algorithm can therefore be understood as a fixed sequence of steps or work instructions, the execution of which leads to the desired result, namely in this case clean and hygienic hands. In even more general terms, they define procedures by which input values (dirty hands) can be transformed into fixed output values (clean/hygienic hands).

In computer science, however, this general definition is not sufficient. An algorithm is a finite set of steps whose execution leads to the solution of a predefined problem. If it is executed several times, it always delivers the same result.

Furthermore, an algorithm is well-defined if it contains only unambiguous instructions that can be executed exactly as they are. For example, a step of the hand washing instructions could be “Wash your hands under the stream of water.” This step is not well-defined because the execution is not clear from it. For example, questions such as “For how long do the hands need to be washed?” or “How strong should the water jet be for this?” still arise.

### What are the Properties of an Algorithm?

The following properties are indicative:

• Unambiguity: The descriptions and steps must be unambiguous.
• Executability: All steps must be executable if the previous steps were executed correctly.
• Finiteness: Finiteness means that there is a finite set of steps to be executed.
• Termination: Termination means that the algorithm reaches a result after a certain amount of time. Termination and finiteness are mutually dependent. So by the finiteness of the steps, the function must come also forced to an end.
• Determinacy: Given the same circumstances, the process steps always lead to the same result.
• Determinism: At each time of the execution there is exactly one unique subsequent step, which must be executed. This property is also a prerequisite for determinacy. If there were a selection of possible subsequent steps, there could not be an unambiguous result.

### What are some examples?

• Navigation Device: The route description of a navigation device contains many successive steps that eventually lead to the entered destination. It thus satisfies all the properties of algorithms.
• Game Roboters: When computers learn games, such as chess or Go, they in many cases adhere to predefined sequences of steps. These have been programmed so that they are simply executed when a certain situation is recognized.
• Mathematics: Mathematical functions also represent algorithms, since they specify a precise sequence of how to get from an input value to an output value.
• Traffic Lights: The switching times of traffic lights are also determined by clear instructions. Depending on the time or the measured traffic density, the traffic light switches from red to green and vice versa.

### How are Machine Learning and Algorithms related?

As we have already learned, algorithms are defined process chains that always achieve the same result with the same inputs. In the field of Machine Learning, it is therefore often referred to as algorithms that are capable of learning complex relationships.

For the grouping of data points, the so-called k-means clustering is often used. Here, different cluster centers are tested in a finite set of steps until sooner or later the perfect assignment in groups is learned. So this is actually an algorithm.

Such a unique mapping is also given for other Machine Learning algorithms, such as the Decision Tree or the Support Vector Machines.

In the field of deep learning, however, this assignment is not quite so obvious. In the case of neural networks, two training runs with the same data sets can lead to different results. This would actually speak against an assignment to the algorithms. However, this is mainly due to the initialization of the network during which, for example, the weights of the individual neurons are randomly assigned. If among other things, it is ensured that the weights are the same in two training runs, the results of the networks would also be the same. Thus, deep learning models also count as algorithms.

### This is what you should take with you

• An algorithm includes finitely many steps to solve a given task.
• If the sequence of these workflows is followed, the task will be solved subsequently in any case and the same results will always be delivered.
• We encounter algorithms very often in everyday life, such as in navigation devices or traffic lights.
Machine learning models are also among them.

### Other Articles on the Topic of Algorithms

On Wikipedia, there is a detailed article on the topic.