How algorithms affect your life – Johann Mifsud

In today’s IT society, we often come across the word “algorithms”, but what are they and what are they used for?

Essentially, an algorithm refers to a set of structured actions that are taken to produce an expected result. The result can be simple, like sorting a list of names alphabetically or a vending machine giving change to a customer, or more complicated, like finding the cheapest flight to a destination.

A useful analogy would be that of a recipe. In a cake recipe, for example, we first weigh the ingredients, such as sugar, flour, etc., then we combine them in a certain way and bake at a preset temperature. The proportions of the ingredients, the way they are mixed and the cooking time will give the desired result – a soft and fluffy cake.

So, algorithms can be considered as a means or a “method” to find a solution to a particular problem. To better illustrate, let’s take a practical example, that of a saleswoman giving the correct change to a customer. What “method” does the assistant use to give the right change? Well, actually, there is an algorithm that goes by the fancy name “greedy algorithm”, and here’s how it works:

The assistant knows the different values ​​of the change he has in the cash box: €20, €10, €5, €2, etc., and from these, at each step, the assistant reduces the difference until the total change returned is reached.

Now suppose that the customer buys goods for a value of €3. The algorithm is called “greedy” because it always takes the largest denomination that corresponds to the remaining currency, in this case €10. Now the remaining change is $7, which is returned to the algorithm as input; in this step, he chooses 5 €. The rest is €2; this is again fed as input, the algorithm choosing the 2 €, which in this case leaves a remainder of 0 €, which completes and stops the operation.

Essentially, the crux of the algorithm is that after part of the change has been given, the callback digit is returned as input to the next iteration of the algorithm, until no change is given. necessary, which halts the system. He uses a “divide and conquer” approach to arrive at the solution. This same algorithm is at work in vending machines when they give you change.

It is important to note that the algorithms are a combination of mathematics and computer science, based on key characteristics such as efficiency and other criteria. Algorithms have been designed for a myriad of applications, ranging from organ matching, based on donor and recipient blood type, to matchmaking applications, based on multiple user preferences and traits. . Algorithms are able to handle such tasks in short periods of time and with an accuracy that would be impossible to achieve if done manually by humans.

Algorithms are a combination of math and computer science, based on key characteristics such as efficiency and other criteria

From the examples above, we can clearly see that algorithms are powerful tools that have a significant impact on our daily lives, ranging from saving lives to finding a life partner. Our understanding of existing algorithms and further studies in the field will be key to finding ever more practical applications that have a significant impact on our lives. Indeed, new algorithms could prove instrumental in solving the problems of our society, such as reducing urban congestion and using energy more efficiently.

This article has been prepared by bringing together various publicly available online sources.

Independent journalism costs money. Support Times of Malta for the price of a coffee.

Support us

Sharon D. Cole