Algorithms
An algorithm is a precise sequence of steps for solving a problem or completing a task.
▶ Interact
Play with the controls to see the idea in action.
📘 Learn
An algorithm is a precise sequence of steps for solving a problem or completing a task.
- Algorithms must be clear and finite
- They can be written as flowcharts or pseudocode
- Recipes are everyday algorithms
🧠 Quick quiz
Three questions. Score 2 or more to complete the topic.
What is Algorithms?
Within Computer Science, which covers algorithms, programming, data, networks, hardware and safe, responsible use of technology, this topic explains Algorithms. Computing topics explain how software, hardware and data work, with diagrams and models that show each step in order.
Check that you can explain Algorithms in your own words and give one example from everyday life. If you can do that, you have understood the core idea.
Understanding Algorithms helps you design, test and explain programs, websites and systems, from small projects to exam questions.
Algorithms in detail
An algorithm is a step-by-step set of instructions for solving a problem or completing a task, such as a recipe or directions. Good algorithms are clear, unambiguous, correct, finite and efficient, and the same input always gives the same output.
Algorithms can be shown as flowcharts or pseudocode and then turned into a program. Examples include searching, sorting, route-finding and encryption. Judging an algorithm involves its correctness and its efficiency in time and memory. Computational thinking about problems often starts with designing an algorithm.
How the interactive helps you understand Algorithms
Click a step, or use the Previous and Next buttons, to move through the sequence one stage at a time. Auto-play moves on for you.
Before you change anything, predict the result. Then change one value at a time and check whether your prediction was right. This is a quick way to build a correct mental model of Algorithms.
Real-life uses and examples
- Apply Algorithms when you design a small program, website or spreadsheet.
- Explain Algorithms to someone new to computing by comparing it to a familiar process.
- Trace through a process that uses Algorithms to check what it does step by step.
Common mistakes to avoid
- Testing only the normal case and forgetting the edge cases.
- Using the term without being able to say what the computer actually does.
- Learning the definition without testing it. Use the quiz and the interactive to check that you can apply the idea.
Frequently asked questions about Algorithms
What is Algorithms?
An algorithm is a precise sequence of steps for solving a problem or completing a task.
What are the most important points about Algorithms?
The main points are: Algorithms must be clear and finite; They can be written as flowcharts or pseudocode; Recipes are everyday algorithms.
Why is Algorithms useful?
Understanding Algorithms helps you design, test and explain programs, websites and systems, from small projects to exam questions.
How can I practise Algorithms?
Open the interactive at the top of this page and change the controls one at a time. Predict the result before each change, then take the three-question quiz. A score of two or more marks the topic as complete on this device.
Which topics are related to Algorithms?
Related topics in Computer Science include Decomposition and Abstraction, Variables and Data Types, Iteration: Loops.