In today’s computer-driven society, we often come across the word ‘algorithms’, 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. The outcome could be simple, such as sorting a list of names in alphabetical order or a vending machine 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 the ingredients, such as sugar, flour, and so forth, then we combine them in a certain way and bake at a pre-set 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 or ‘a method’ to find a solution to a particular problem. 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 various values of the currency he or she has in the cash register: €20, €10, €5, €2, and so on, and from those, at each step, the assistant reduces the difference until the complete change given is reached.

Now let us 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, the 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 the €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 part of the change is given, the reminder figure is fed 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 same algorithm is at work in vending machines when they give you your change.

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

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

From the above examples, we can clearly see that algorithms are powerful tools that have 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 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 using energy more efficiently.

https://eskills.org.mt/en/Pages/Home.aspx

This article was prepared by collating various publicly available online sources.

Sign up to our free newsletters

Get the best updates straight to your inbox:
Please select at least one mailing list.

You can unsubscribe at any time by clicking the link in the footer of our emails. We use Mailchimp as our marketing platform. By subscribing, you acknowledge that your information will be transferred to Mailchimp for processing.