Algorithms: clear steps for a task — Computing, 11–13 years
An algorithm is a plan that tells a person or a computer what to do, and in what order. Computing, 11–13 years.
What an algorithm is
An algorithm is a set of steps for reaching a result. The steps must be clear enough that someone else, or a computer, can follow them without guessing. A recipe, a route to school and a program can all be algorithms.
Why algorithms matter
Computers are fast, but they do not fill in missing instructions with common sense. People needed repeatable methods for calculations, sorting records and following routes long before modern computers existed. Writing the method down makes results easier to check and repeat.
Worked example: finding the largest number
Take the numbers 7, 3, 12 and 9. Start by calling 7 the largest; compare it with 3, then 12, then 9, replacing the largest whenever a bigger number appears. You finish with 12, and the same steps work for any list of numbers.
Trap: a step that is too vague
A common mistake is writing “sort the numbers” or “make it nice”. That sounds sensible to a human because we know what might be meant, but a computer has no shared context. Replace vague words with actions, such as “compare the next two numbers and swap them if the left one is larger”.
Where algorithms appear
Navigation apps use algorithms to compare routes and estimate travel time. Online shops use them to search and arrange products, while video apps use them to choose possible recommendations. These systems follow rules over data; they do not understand your life in the way a friend does.
Keep exploring
Other languages
Loading MyLeoNes™…