Publish in core platform
Digital technology / specialisationSoftware Digital skills
Digital skill levelBasic
Geographic Scope - CountryMalta
Type of initiative
Article by Johann Mifsud Executive at eSkills Malta Foundation published on the Sunday Times of Malta on 13.03.2022
In today’s computer-driven society, we often come across the word ‘Algorithm’, but what are they and what are they used for?
In essence, an algorithm refers to a set of structured actions that are taken to yield an expected outcome. An outcome can be simple as sorting a list of names in alphabetical order, giving change to a customer or more complicated like finding the most economical flight to a destination.
A useful analogy would be that of a recipe. In a recipe for a cake, for instance, we first weigh ingredients such as sugar, flour etc then we combine them in a certain way and bake at a certain temperature. The proportions of the ingredients, the way they are mixed and the length of cooking will yield the desired outcome. A cake that is soft and moist.
Thus algorithms can be thought of as a way to find a solution to a particular problem or ‘a method’. To better illustrate let us take a practical example, that of a shopping assistant 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 of ‘greedy algorithm’ and this is how it works:
The assistant knows the value of the currency it has in the drawer; €20, €10, €5, €2 and so on, and from those at each step it reduces the difference until the complete change given is reached. Now let’s say the customer buys goods for the value of €3. The algorithm is called greedy because it always takes the largest denomination that fits in the remaining change, in this case, €10. Now remaining change is €7 which is fed back to the algorithm as input in this step it chooses €5. The remainder is €2 this is fed once again as input with the algorithm choosing €2 which in this case leaves a remainder of €0 which completes and stops the operation.
In essence, the crux of the algorithm is that, after a part change is given, the reminder figure is put back as input to the next iteration of the algorithm, until no change needs to be given, which stops the system. It uses a divide and conquer approach to get to the solution. This exact algorithm is at work in vending machines when they give you your change.
It is important to note that algorithms are studied in mathematics and computer science, based on key characteristics such as efficiency and other criteria. Algorithms have been devised for a myriad of applications such as organ matching, based on the blood type of both donors and the recipient to matchmaking Apps based on multiple preferences and character traits of the users. Such tasks would be impossible to handle manually by humans, and with the accuracy that algorithms are able to attain, in short spans of time.
From the examples above we can clearly see that algorithms are powerful tools that have a significant impact on our daily living, such as saving a life or 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 impact our lives in significant ways. Indeed, new algorithms may prove to be instrumental to solve problems ailing our society such as reducing city congestion and making energy usage more efficient and many more.
This article was prepared by collating various publicly available online sources.