Lesson 1 of 8
Algorithms: Lesson 1

Computational Thinking

Discover the four thinking strategies that underpin all problem solving in computer science: abstraction, decomposition, pattern recognition and algorithmic thinking.

45 minutes All exam boards

Every piece of software you have ever used - from a search engine to a video game - was not written by someone who just started typing code. It was built by someone who first thought carefully about the problem: what information matters, how to break it apart, what patterns could be reused, and what precise steps would always produce the right answer. That process of structured thinking is called computational thinking.

Think about it: You are asked to design a school timetabling system for 1,200 students, 80 teachers and 60 rooms. Where do you even start? Which details matter and which can you ignore? Can you spot parts of the problem that look like problems you have already solved? This lesson gives you the framework to answer those questions.
Terms you need to know
Computational thinking
A structured approach to problem solving that formulates problems in a way that a computer can help solve them.
Abstraction
Removing unnecessary detail from a problem so that only the information needed to solve it remains.
Decomposition
Breaking a complex problem into smaller, more manageable sub-problems that can each be solved independently.
Pattern recognition
Identifying similarities and regularities within a problem or between problems to allow solutions to be reused.
Algorithmic thinking
Designing a precise, step-by-step solution that produces the correct result for every valid input.
Algorithm
A precise, finite sequence of instructions that solves a specific problem or performs a specific task.
Abstraction

Abstraction means identifying and removing detail that is not relevant to the problem you are trying to solve. It does not mean making something vague - it means making it appropriately simple so that you can focus on what actually matters.

Abstraction appears everywhere in computer science. A function hides its internal workings behind a name. A class exposes only the methods other code needs. A map of the London Underground shows connections without showing real distances, curves or tunnel depths - none of that detail helps a passenger decide which train to take.

Abstraction in action - designing a login system
Detail removed:
How passwords are encrypted and stored, network protocol used, server hardware, operating system, database engine
Detail kept:
Username, password entered, whether they match a stored record, whether the account is locked or active
Result:
A simpler model that is still complete enough to design and test the login logic
Levels of abstraction

Abstraction is not a single step - it is a spectrum. A high-level programming language abstracts away memory management. An operating system abstracts away hardware. A map app abstracts away everything about the physical road except its route. Each level hides complexity below it and exposes only what the level above needs.

Exam angle

A common exam question gives a scenario and asks which details would be kept and which removed. Always ask yourself: "What does the person or system using this actually need?" Anything beyond that is unnecessary detail and should be abstracted away. The Underground map is the classic example - memorise it and what it illustrates.

Decomposition

Decomposition breaks a complex problem into smaller sub-problems. Each sub-problem is easier to understand, easier to solve and easier to test in isolation. This is why large software projects can be built by teams of hundreds of developers without complete chaos - each person solves one sub-problem, and the pieces are assembled.

The key rule: keep decomposing until each piece is small enough to solve directly. If a sub-problem still feels overwhelming, decompose it further. You stop when each piece can be solved in a single, clear step.

Decomposing an online shopping system
Top level:
Online shopping system
Sub-problem 1:
User accounts - register, login, profile management, password reset
Sub-problem 2:
Product catalogue - browse, search, filter, display details and reviews
Sub-problem 3:
Shopping basket - add/remove items, update quantities, calculate totals
Sub-problem 4:
Checkout - collect address and payment, validate, place order, confirm
Sub-problem 5:
Order management - track status, dispatch notifications, handle returns

Notice that Sub-problem 1 can itself be decomposed. "Register" breaks down into: collect username/email/password, validate format, check for duplicates, hash password, store record, send confirmation email. Each step is now small enough to implement directly.

Exam angle

Exam questions on decomposition typically give a scenario (booking system, game, school admin tool) and ask you to identify sub-problems. Write each sub-problem as a noun-verb pair: "validate login credentials", "calculate delivery cost". Show that each sub-problem is distinct and independently solvable. Overlap between sub-problems suggests you need to decompose further.

Pattern Recognition

Pattern recognition is noticing similarities - either within one problem or between the current problem and problems you have solved before. Recognising patterns allows you to reuse solutions rather than starting from scratch every time.

At the programming level, pattern recognition is why we write loops (the same operation repeats across a list), functions (the same logic is needed in multiple places), and classes (multiple objects of the same type need the same behaviour). At the algorithmic level, recognising "this is a search problem" lets you reach for a known, tested search algorithm rather than inventing one.

Patterns across different problems
Within a problem:
Every item in a shopping cart needs its price calculated the same way - write a function and call it in a loop
Between problems:
Sorting exam scores uses exactly the same logic as sorting names alphabetically - the same sort algorithm works for both
Design pattern:
Login, registration and password reset all need to validate user input - extract shared validation logic into one place
Data pattern:
Student, employee and customer records all have an ID, name and contact details - recognise the shared structure
Why pattern recognition saves time

In professional software development, recognised patterns have names: the "Observer" pattern for event handling, the "Singleton" for a single shared resource, "MVC" for separating data from display. These are documented solutions to recurring problems. Recognising the pattern means you do not have to rediscover the solution.

Algorithmic Thinking

Algorithmic thinking is designing a precise, step-by-step solution that can be followed without ambiguity and that produces the correct result for every valid input. The word "algorithm" comes from the name of a 9th-century Persian mathematician, Al-Khwarizmi, whose book on systematic calculation gave us the word.

An algorithm must satisfy three properties:

🎯
Precise
Every step must be unambiguous. "Sort roughly" is not a step - "compare adjacent elements and swap if the left is greater" is. Anyone following the steps must reach the same result.
Finite
The algorithm must terminate. It cannot run forever. Every loop must have a guaranteed exit condition. An infinite loop is not an algorithm - it is a bug.
Correct
For every valid input, the algorithm must produce the correct output. It must handle edge cases: empty lists, maximum values, duplicate entries.
Algorithm vs program

An algorithm is a logical description of a solution - it is language-independent. The same binary search algorithm can be implemented in Python, Java, C++ or pseudocode. A program is an implementation of an algorithm in a specific language. Understanding algorithms separately from code means you can think about correctness and efficiency before worrying about syntax.

Exam angle

You may be asked to evaluate whether a given algorithm is correct. Check: does every loop terminate? Is the output correct for normal inputs, edge inputs (e.g. an empty list) and boundary inputs (e.g. a list with one element)? These three categories of test data appear frequently in exam questions.

Pillar Classifier
Identify the pillar
For each scenario below, select which pillar of computational thinking it best demonstrates. Click your answer to see if you are correct.

Test yourself

1. A transport app shows bus routes and stops but does not show the physical width of the road, speed limits or road surface type. Which pillar does this best represent?

Correct. The app removes detail (road width, surface, speed limits) that passengers do not need to plan a journey. Only the relevant information - routes, stops and timings - is kept. This is abstraction: removing unnecessary detail to focus on what matters.

2. A developer building a game breaks the project into: display graphics, handle player input, manage enemy AI, track score, play audio. Which pillar does this represent?

Correct. The developer has broken a large, complex problem (build a game) into five smaller, independently solvable sub-problems. This is decomposition. Each sub-problem can now be assigned to a different developer or solved at a different time.

3. Which of the following is NOT a required property of an algorithm?

Correct. An algorithm is language-independent - it can be expressed in pseudocode, a flowchart, or any programming language. The required properties are that it must be precise, finite and correct. Requiring Python would make it a program, not an algorithm.

4. A programmer notices that sorting a playlist by song length uses the same comparison logic as sorting by album name. They reuse their existing sort function. Which pillar is this?

Correct. The programmer recognised that two different problems (sort by length, sort by name) share the same underlying pattern (compare two values and order them). By recognising this, they can reuse the same solution rather than writing it twice. This is pattern recognition.

5. A student writes an algorithm to find the largest number in a list. They test it with [3, 7, 1, 9, 2] and it returns 9. However they have not tested it with an empty list. What property of a good algorithm have they failed to verify?

Correct. An algorithm must be correct for all valid inputs, including edge cases. An empty list is a valid input for a "find maximum" algorithm, and the algorithm must handle it without crashing or giving a wrong answer. Testing only a single normal case is insufficient.
Challenge question

A student argues that abstraction and decomposition are the same thing because both involve "simplifying" a problem. Explain why they are distinct pillars using a specific example to illustrate the difference.

They are fundamentally different operations. Abstraction is about removing irrelevant detail while keeping the model complete enough to be useful - you are still looking at the whole problem, just with less noise. Decomposition is about dividing the problem into separate parts - you end up with multiple smaller problems where you only had one before.

Example: Designing a weather app. Abstraction would involve deciding to ignore the physics of atmospheric pressure and just work with temperature, wind speed and rainfall data. Decomposition would involve splitting the app into sub-problems: fetch weather data, parse the data, display a forecast, handle location permissions. Abstraction removes columns from your view; decomposition splits the problem into rows.
Printable Worksheets

Practice what you have learned

Three levelled worksheets for this lesson. Download, print and complete offline.

Recall
Computational Thinking Fundamentals
Pillar definitions, matching activities and fill-in-the-blank questions on abstraction and decomposition.
Download
Apply
Applying the Four Pillars
Given six real-world scenarios, identify which pillar(s) apply and justify your answer with evidence from the scenario.
Download
Exam Style
Exam-Style Questions
Extended response questions on decomposition and abstraction with mark scheme. Includes a 6-mark structured question.
Download
Lesson 1 - Algorithms
Computational Thinking
Starter activity
Write the following on the board: "Design a system to manage 1,200 students, 80 teachers, 60 rooms and 200 courses so that no two classes clash." Give students 3 minutes to write down everything they think the system needs to know. Then reveal that most of what they wrote is unnecessary - use this to introduce abstraction naturally. Then ask: "How would you split this between a team of 5 developers?" to introduce decomposition.
Lesson objectives
1
Define computational thinking and state why it is a useful problem-solving approach.
2
Explain abstraction and give an appropriate real-world example.
3
Apply decomposition to break a given problem into distinct sub-problems.
4
Describe pattern recognition and explain how it allows solutions to be reused.
5
State the three required properties of an algorithm and explain each.
Key vocabulary
Abstraction
Removing irrelevant detail. The Underground map is the canonical example - real distances removed, connections kept.
Decomposition
Dividing a problem into sub-problems. Each sub-problem must be distinct and independently solvable.
Pattern recognition
Spotting similarities within or between problems to reuse solutions. Drives use of loops, functions and classes.
Algorithmic thinking
Designing a precise, finite, correct sequence of steps. Language-independent - not tied to Python or any language.
Discussion questions
Can you think of a real-world algorithm that is not a computer program? (Recipe, assembly instructions, a bus timetable.)
If abstraction removes detail, how do we decide which detail is "unnecessary"? Who decides?
Why is it important that an algorithm terminates? What happens if it does not?
Exit tickets
State two differences between abstraction and decomposition. [2 marks]
A sat-nav shows roads and junctions but not the number of lanes or road surface quality. Name the pillar this illustrates and explain why those details were removed. [2 marks]
State three properties that every algorithm must have. [3 marks]
Homework suggestion
Choose a complex everyday task (booking a holiday, planning a school event, running a small business). Apply all four pillars: list what detail you would abstract away, decompose it into sub-problems, identify any patterns with problems you already know how to solve, and write a brief algorithmic description of one of the sub-problems.