Tue. May 7th, 2024
What is an algorithm?
Photo by Antonio Batinić: https://www.pexels.com/photo/black-screen-with-code-4164418/

What is an algorithm? An algorithm is a set of instructions to solve a particular problem.

The word algorithm came into English from French. It came into French from the Latin word “algorismus”, which was a slightly mistaken translation of the Arabic word “al-Khwarizmi”, which means “native of Khwarazm”. In about AD 825, the Arabic mathematician, Muhammad ibn Musa al Khwarizmi, wrote several books about mathematics and algebra. These books were translated into Latin in the 12th century and the word algorismus came into being. It found its way into English, but it didn’t take on its current meaning until 1811. Incidentally, the word algebra also comes from Muhammad ibn Musa al Khwarizmi. He wrote a book called “al-mukhtasar fi hisab al-jabr wa al-muqabala” (the compendium on calculation by restoring and balancing). “Al-jabr” became algebra.

We think of algorithms being the way that computer software of AI systems run, but an algorithm is only the series of steps that are required to solve one specific problem. Baking a cake by following a recipe is an example of an algorithm. Ants foraging for food is another very good example. Ants are sent out in all directions to find food for the colony. When an ant finds a food source larger than something it can carry on its own, it returns to the colony and uses pheromones to say that it has found food. The colony then sends out more ants to retrieve the food. If there is still more food, the ants return and signal that there is still food, and still more ants are sent. This continues, with more and more ants being sent until the ants stop returning because the food source has gone, and they have headed off to search for more food. This is an algorithm. The problem is finding food. When there is a positive signal, the colony has one action, when there is a negative signal, the colony has a different action.   

Computers run on algorithms because a computer can only do what it is told to do. If I ask you to add 2 and 2, you will be able to give me the answer 4 without thinking about it because you just know that 2 and 2 is 4. However, if I give you a much larger number, you will need to write it down and go through the steps of long addition to do it. These steps are how a computer works. For example, 2+2=?.

Step 1: Start
Step 2: Declare variables num1, num2 and sum.
Step 3: Read values num1 and num2.
Step 4: Add num1 and num2 and assign the result to sum.
        sum←num1+num2
Step 5: Display sum
Step 6: Stop

This is a very basic algorithm that adds two numbers together. The computer goes through it incredibly quickly, but it must go through every step. Then, if you want to get computers to do something more complex, you just keep adding steps to the algorithm. This is how simple calculation and simple computer programs work. These days, though, algorithms are becoming far more complex because computers are becoming far more complex. AI systems use different types of algorithms, and they are far more complicated than just adding two numbers. They use a combination of algorithms for different parts of their processing and they are able to self-learn by using large quantities of data and altering their actions based upon that data. They can use this data to rewrite their algorithms or to create new algorithms. AI systems use three different types of algorithms: supervised learning, unsupervised learning, and reinforcement learning.

Supervised learning systems are given labeled data, and they use that data to create connections between the points. They are often used for things like database management or object classification. Unsupervised learning systems are given unlabeled data, and they have to work out how to connect the data. These two types of systems stop when their task has been performed. Reinforcement learning systems work by taking in the result of an action and performing another task based on that result. In the same way as the ants looking for food, if the result is positive there will be one action and if the result is negative there will be another action. There are many many different types of algorithm that work inside all of these systems and they are constantly increasing. These days algorithms are so complex, that algorithm writing AI systems are necessary. Will there be anything to fear when the computers start writing their own algorithms? That, I don’t know. And this is what I learned today.

Photo by Antonio Batinić: https://www.pexels.com/photo/black-screen-with-code-4164418/

Sources

https://www.techtarget.com/whatis/definition/algorithm

https://www.programiz.com/dsa/algorithm

https://en.wikipedia.org/wiki/Algorithm

https://www.geeksforgeeks.org/nature-inspired-optimization-algorithms/

https://www.etymonline.com/word/algorithm

https://www.tableau.com/data-insights/ai/algorithms