Start by saying what result is needed
Suppose an event organiser has the checkpoint codes [14, 5, 9, 3, 12] in that order. In this worked example, the request is code 9. The task is to report its first position, counting positions from zero, or to report Absent if no code matches. That is more precise than 'find something useful about the checkpoints'.
An input is data supplied to the method: here, the ordered codes and requested code. Processing is the work done with that data. An output is the result produced. The requested 9 is an input; the resulting position 2 is an output. They are different numbers with different meanings, even though both describe the same lookup.
Computational thinking means organising a problem so a solution can be specified clearly. We will split the work, keep only the details the result needs and give precise steps. These ideas support one another: discovering a missing requirement can make us revisit an earlier model rather than follow one compulsory planning order.
| Position, starting at zero | Checkpoint code |
|---|---|
| 0 | 14 |
| 1 | 5 |
| 2 | 9 |
| 3 | 3 |
| 4 | 12 |
Split the job without deleting a requirement
Decomposition means splitting a problem into smaller problems with identifiable jobs. The organiser's lookup can be split into receiving the request, checking that the supplied data has the expected form, finding a matching position and reporting the result. Each smaller job still helps deliver the whole required outcome.
A smaller job can be designed and checked on its own when its inputs and outputs are clear. For example, test the matching job using the supplied list and request 9: it should give position 2. The reporting job then turns that result into a message. It should not start searching the list again because it was not told what the matching job found.
Removing the difficult 'Absent' outcome is not decomposition: it deletes a requirement. Nor is a list of nouns such as 'screen, computer, user' enough to explain the subtasks. Say what each part does and what information is passed to the next part. Detailed structure diagrams are developed in the next topic.
| Smaller job | Information received | Information produced |
|---|---|---|
| Receive request | User's requested code | Requested code, here 9 |
| Check supplied data | Request and ordered checkpoint list | Usable data or an input problem |
| Find first match | Usable list and request | First matching position or Absent |
| Report result | Position or Absent | A message with that result |
Keep the information that can change this result
Abstraction means leaving out unnecessary detail while keeping what the solution needs. A model is a representation containing the details chosen for a task. The organiser's full record for code 9 has a position, the name Raven Gate, copper paint and misty weather. For this code lookup, comparing the checkpoint code and retaining its position are enough.
Removing paint colour does not make the code comparison less accurate: paint cannot change whether code 9 matches the requested 9. Removing the code itself would make the lookup impossible. Removing the order would also be wrong because the output is the first matching position. Abstraction is a reasoned choice, not making everything vague or deleting as much data as possible.
A detail is relevant to a particular question, not permanently relevant or irrelevant. Weather is unnecessary for this code lookup, but could matter in a different task that decides whether an outdoor checkpoint is safe to use. Always link the keep-or-omit decision to the result actually requested.
| Detail in the worked record | Keep for this lookup? | Why |
|---|---|---|
| Code: 9 | Keep | Compare it with the requested code |
| Position: 2 | Keep order/position available | Report the first matching position |
| Name: Raven Gate | Omit | The requested result is a position, not a name |
| Paint: copper | Omit | Paint cannot change the code comparison |
| Weather: mist | Omit | This task does not decide whether the checkpoint is safe |
Give steps that leave no decision to guesswork
An algorithm is a sequence of steps that can be followed to complete a task. Algorithmic thinking means working out precise steps, decisions and stopping conditions. 'Find the code somehow' states a goal but does not tell another person what to do when several records exist or no code matches.
For the worked lookup, start at position zero. Before inspecting a record, check that a position remains in the list. If none remains, report Absent and stop. Otherwise compare the code at the current position with the request. On a match, report that position and stop. On a mismatch, advance one position and repeat the check. The list order stays unchanged.
This method terminates for a finite list: each mismatch advances past one item, and either a match is found or there are no items left. The empty list reaches Absent without inspecting a nonexistent first item. Defining both outcomes is part of making the method complete. This is a plain-language method, not a code-writing exercise.
Follow the decisions in order
- Start with position 0.
- If no item remains, report Absent and stop.
- Compare the current code with the requested code.
- On a match, report the position and stop.
- Otherwise move to the next position and return to the remaining-item check.
Every step specifies an action or a decision; both a match and an exhausted list have a defined ending.
Continue with your exam board
The course combines lesson videos, interactive activities, topic questions and original exam mocks. Sign in to use the learning tools and save your progress; your account’s course access applies.
Independent learning resources. Not endorsed by AQA or OCR. These public introductions complement the full course and the official specification.