IB Computer Science · B1 · Computational thinking
B1.1 Approaches to computational thinking
Describe the main steps in solving a computational problem and explain how abstraction, decomposition, pattern recognition and generalisation support them.
1/5Computational problems are solved in a series of steps
- Computational problems are solved in a series of steps
- Abstraction removes detail that the problem does not need
- Decomposition splits a large problem into smaller parts
- Pattern recognition finds similarities that can be reused
- Generalisation turns a pattern into a reusable solution
- Check your recall
- Practice: 10 questions
Part 1 of 5: Computational problems are solved in a series of steps
Planning a school trip means deciding where to go, who pays and how everyone travels. A computational problem needs the same care before any code is written. Computational thinking is the habit of working through such problems in an organised way.
The plan itself is an algorithm, a set of exact steps that always leads to a result. Building it usually follows five stages.
- Understand the problem: what is given and what must be produced
- Plan a solution as an algorithm
- Implement the plan as a program
- Test the program with a range of inputs
- Evaluate the result and refine it
Key terms · tap one for its definition
computational thinking
Computational thinking is the process of analysing a problem and expressing its solution so that a computer or person can carry it out.
algorithm
An algorithm is a finite sequence of unambiguous steps that solves a problem or completes a task.
Part 2 of 5: Abstraction removes detail that the problem does not need
Once the problem is clear, you must decide what to keep in your plan. A map of the underground shows stations and lines. It leaves out streets, buildings and true distances. This is abstraction.
In a program, abstraction decides what data to store. A library system needs a book’s title and its borrower. It does not need the colour of the cover. The result is a model, a simpler version of the real system.
Key terms · tap one for its definition
abstraction
Abstraction is the process of removing or hiding detail that is irrelevant to a problem so that its essential features stand out.
model
A model is a simplified representation of a real system that keeps only the features relevant to the problem.

Quick check
One question on the part you just read
Easy
Show answer and explanation
Answer: B · Worked explanation
Part 3 of 5: Decomposition splits a large problem into smaller parts
Even a simplified problem can be too large to solve in one go. Decomposition breaks it into smaller sub-problems. Each sub-problem can be solved and tested on its own, and then the solutions are combined.
Organising a school concert shows the idea. One group handles tickets, another handles lighting, and a third handles music. In software, an online shop splits into a catalogue, a basket, a payment step and order tracking.
Key term
decomposition
Decomposition is the process of breaking a complex problem into smaller sub-problems that can be solved separately.
Part 4 of 5: Pattern recognition finds similarities that can be reused
After splitting a problem, you often find that some parts look alike. Pattern recognition is noticing features or behaviour that repeat. Sorting names and sorting prices, for example, both compare items and swap them into order.
Spotting a pattern saves effort. If you have solved one part, you can reuse the same approach on the others. Patterns also help you predict what a program will do next.
Patterns can appear inside one problem as well. A loop in code is a pattern, because the same steps repeat. Finding it keeps the solution short.
Key term
pattern recognition
Pattern recognition is the process of identifying similarities, trends or repeated structures within a problem or between problems.

Quick check
One question on the part you just read
Easy
Show answer and explanation
Answer: C · Worked explanation
Part 5 of 5: Generalisation turns a pattern into a reusable solution
Recognising a pattern is only half of the job. Generalisation writes the common steps once, in a form that works for many cases. A routine that adds any two numbers is more general than code that adds only 3 and 4.
A parameter makes this possible. The values that change become inputs, and the repeated steps stay fixed.
Pattern recognition compared with generalisation
- Feature
- Main action
- Pattern recognition
- Notices what repeats
- Generalisation
- Writes one solution for all cases
- Feature
- Result
- Pattern recognition
- A described similarity
- Generalisation
- A reusable method
- Feature
- Order
- Pattern recognition
- Comes first
- Generalisation
- Follows from the pattern
- Feature
- Example
- Pattern recognition
- Seeing that two tasks both sort
- Generalisation
- A sort routine for any list
Together they let one tested solution serve many problems.
Key terms · tap one for its definition
generalisation
Generalisation is the process of turning a recognised pattern into a solution that works for a whole class of problems.
parameter
A parameter is a named input to a routine, with its value supplied each time the routine is used.
Check your recall[15 marks]
5 written questions. Answer each one in your head or on paper, then open the mark scheme.
- 1.Outline[4 marks]
Outline the main steps in solving a computational problem.
Show mark schemeHide mark scheme
Model answer
First understand the problem, including what is given and what is needed. Then plan a solution as an algorithm and implement it as a program. Test the program, then evaluate and refine it.
- 1 mark for stating that the problem must first be understood
- 1 mark for stating that a solution or algorithm is planned
- 1 mark for stating that the plan is implemented and tested
- 1 mark for stating that the result is evaluated and refined
- 2.Explain[2 marks]
Explain how abstraction simplifies a complex problem.
Show mark schemeHide mark scheme
Model answer
Abstraction removes detail that is irrelevant to the problem. This leaves a simpler model that is easier to understand and to solve.
- 1 mark for stating that irrelevant detail is removed or hidden
- 1 mark for explaining that the simpler model is easier to understand or solve
- 3.Describe[3 marks]
Describe how decomposition could be used to design a system that runs a school library.
Show mark schemeHide mark scheme
Model answer
The whole library system is split into smaller sub-problems, such as recording books, loans, members and fines. Each sub-problem is solved and tested separately. The solutions are then combined into the full system.
- 1 mark for stating that the system is broken into smaller sub-problems
- 1 mark for giving suitable sub-problems such as books, loans, members or fines
- 1 mark for stating that each part is solved separately and then combined
- 4.Compare[3 marks]
Compare the roles of pattern recognition and generalisation in computational thinking.
Show mark schemeHide mark scheme
Model answer
Pattern recognition identifies features or steps that repeat across problems. Generalisation uses that pattern to build one solution that works for many cases. Recognition comes first, and generalisation follows from it.
- 1 mark for stating that pattern recognition identifies repeated features or similarities
- 1 mark for stating that generalisation builds one solution for many cases
- 1 mark for linking the two, with the pattern leading to the general solution
- 5.Explain[3 marks]
Explain why a generalised solution is more useful than one written for a single case.
Show mark schemeHide mark scheme
Model answer
A generalised solution uses parameters, so it works for many inputs. It avoids rewriting similar code for each case. One tested solution is easier to maintain and less likely to contain errors.
- 1 mark for stating that it works for many inputs or cases
- 1 mark for stating that similar code does not need to be rewritten
- 1 mark for explaining that one tested solution is easier to maintain or has fewer errors

Practice this topic
10 quick-fire multiple-choice questions, easy to hard. Tap an answer to see if you're right and the worked explanation. (The written questions with mark schemes are under “Check your recall” above.)
0 right0 of 10 answered
Includes the 2 quick checks in the note above.
Easy[1 mark]
Show answer and explanation
Answer: D · Worked explanation
MediumDeduce[1 mark]
Show answer and explanation
Answer: B · Worked explanation
MediumDeduce[1 mark]
Show answer and explanation
Answer: C · Worked explanation
MediumDeduce[1 mark]
Show answer and explanation
Answer: D · Worked explanation
MediumDeduce[1 mark]
Show answer and explanation
Answer: B · Worked explanation
Hard[1 mark]
Show answer and explanation
Answer: D · Worked explanation
Hard[1 mark]
Show answer and explanation
Answer: B · Worked explanation
Hard[1 mark]
Show answer and explanation
Answer: A · Worked explanation