Introduction to Algorithms

What is an algorithm?

In computer science, you’re quite likely to hear the term algorithm – but what does this actually mean? Well…

An algorithm is a set of instructions in order to complete or solve a certain task

You can think of examples of this in the real world – just think of an algorithm like a recipe.

For example, making a cup of tea, playing a card trick, driving to a traffic light, baking a cake…

cake

However, in computer science, algorithms are used to make programs and apps that you use on a daily basis. This might be using a calculator, saving a program, writing a letter…

A computer uses binary (0s and 1s) to run instructions, and an algorithm gives the instructions to the computer in the correct order so a program works properly.

algorithm

So, an algorithm is basically like a recipe for the computer to follow. The computer will follow the instructions in the correct order and then carry out the tasks that it has been told to do.

We often write algorithms on a computer using a programming language when we write code and use programming; however, we can write an algorithm using pseudo code or a flowchart. Even if you tell a story of how a computer follows instructions, you are still writing an algorithm!