Algorithms: clear steps for a task — Technology, 11–13 years
An algorithm is a precise plan for reaching a result. People use algorithms when cooking or sorting, and computers use them to repeat instructions quickly and consistently.
A recipe for a result
An algorithm is a set of steps that tells someone or something how to complete a task. The steps must be clear enough that two people, or two computers, can follow them and get the expected result. It can include choices such as “if this happens, do that”.
Why computers need algorithms
A computer can perform instructions very quickly, but it does not guess what a vague request means. Algorithms solve the problem of turning a goal, such as finding a name in a list, into repeatable actions. Better algorithms can save time when the amount of information grows.
Finding the largest number
For 7, 3, 9 and 5, start by calling 7 the largest. Compare 3 with 7, so keep 7; compare 9 with 7, so replace it with 9; compare 5 with 9, so keep 9. The answer is 9, and the same steps work for any list.
A vague step is not a usable step
“Put the books in a sensible order” sounds helpful to a person, but a computer cannot act on “sensible” without more detail. You might mean alphabetical order, height order or publication date. This mistake is reasonable because humans fill in missing meaning from context; machines need it stated.
Searches and recommendations
A search engine uses algorithms to compare your words with information in a huge collection and rank possible matches. Video and music services also use algorithms to suggest items based on patterns in your choices. A suggestion is a calculation, not proof that you will like it.
Keep exploring
Other languages
Loading MyLeoNes™…