Computational thinking and problem solving

A-Level Computer Science · Advanced Architecture, Networks and Computational Thinking

The four elements

Decomposition breaks a problem into subproblems small enough to solve. Pattern recognition spots that two subproblems are the same shape, so one solution serves both. Abstraction removes detail that does not matter for the problem at hand. Algorithm design writes the sequence of steps.

Abstraction is the one that is misunderstood

It does not mean 'making something vague'. It means deliberately ignoring detail that is irrelevant to the purpose. A underground railway map is a classic example: it discards true distances and geography because a passenger only needs the order of stops and where lines cross. The same map would be useless for planning a walk — abstraction is always relative to a purpose, and saying that earns the mark.

Caching and prefetching as abstraction in hardware

A cache stores recently used data close to the processor so the next access is fast; it works because programs display locality of reference — they reuse the same data and run through nearby addresses. Prefetching guesses what will be needed next and loads it early.

Judging an algorithm

Correctness first: does it produce the right answer for every valid input, including boundary cases? Then efficiency in time and in memory. Then readability and maintainability, which matter because most of a system's cost is maintenance. A faster algorithm nobody can understand is a liability.

Bringing the course together

Almost every A2 question is a variant of the same shape: given a situation, choose an approach, justify it against the constraints in the case, and state what it costs. Data structure, algorithm, architecture, network and methodology questions all reward the same discipline — name the trade-off rather than declaring one option best.

Worked example: apply the four computational thinking components to a problem

A school wants to build a timetabling system: $60$ classes, $45$ teachers, $30$ rooms, each class needs $8$ subjects per week, no teacher teaches two classes at the same time, no room is used for two classes at the same time, and the laboratories are used only for practical subjects.

Apply the four computational thinking components.

Solution

Decomposition — break the big problem into solvable sub-problems.

$1.$ Represent the data: classes, teachers, rooms, subjects, lessons.
$2.$ Check constraints: given an arrangement, does it break any rule.
$3.$ Generate scheduling options.
$4.$ Evaluate and improve a valid option (for example reduce the teachers' free periods).
$5.$ Display and print the timetable.

Note that sub-problem number $2$ is separate from number $3$: constraint checking must be independent of generating options, because it is called thousands of times and needs to be optimized on its own.

Pattern recognition — find the similarities so you can write one solution to reuse.

The three constraints 'a teacher does not teach in two places at once', 'a room is not used in two places at once' and 'a class does not have two subjects at once' have the same shape: a resource must not appear twice in the same period.

So you only need to write ONE function CheckClash(resource, period) and call it three times, instead of writing three nearly identical pieces of code. This is the real practical value of pattern recognition — less code, fewer bugs, and fixing one place fixes all three.

Abstraction — remove what is not relevant to the purpose.

The system does NOT need to know: the full name of a subject, the content of lessons, a teacher's age, the floor area of a room, or the number of students in a class.

It only needs: a resource code, which period, and a flag saying whether a room is a laboratory together with a flag saying whether a subject is a practical one.

Note that abstraction is tied to purpose: if the school later wants the system to check room capacity as well, then the number of students becomes necessary information. The same data, a different purpose, a different level of abstraction.

Algorithm design.

The simplest approach is backtracking: place each class and subject in turn into the first valid period, and if you reach a dead end, go back and change an earlier choice.

But the performance issue must be stated: the number of combinations is huge, so pure backtracking can run for a very long time. The practical remedy is to place the TIGHTEST constraints first — the practical subjects that need a laboratory, because they have the fewest options — and only then place the rest. This is an example showing that choosing the order of processing matters as much as choosing the algorithm.

Common mistake

Understanding abstraction as 'being vague' or 'simplifying to make things easier'. It is DELIBERATELY removing details that are irrelevant to a specific purpose — and the same detail can be dropped for one purpose but must be kept for another.

Key takeaway

The four components: decomposition, pattern recognition, abstraction, algorithm design. Abstraction is always tied to a purpose. And for every A2 question, the answer template is: choose an approach, justify it using the constraints in the question, then state the cost.

← Modern networks, protocols and the internet of things · All A-Level Computer Science lessons · Practice A-Level Computer Science questions (free, instant scoring)