Thinking, drawing, tracing, searching, sorting. This unit is paper thinking — you will write the same ideas in Python on the programming page. Jump to merge sort if you already know flowcharts.
2.1.1 Computational thinking
Three words. Exam questions often ask you to spot which one a sentence is describing.
| Idea | Meaning | Tiny example |
|---|---|---|
| Decomposition | Break a problem into smaller sub-problems | A game: input, movement, collision, score, draw |
| Abstraction | Ignore unnecessary detail; keep what matters | Tube map: not every alley, just stations and lines |
| Algorithmic thinking | Work out logical steps that solve it | “If colliding with ghost and not powered, lose a life” |
They stack: decompose the game, abstract the collision to rectangles, write an algorithm for each piece.
2.1.2 Designing, creating and refining algorithms
Inputs, processes, outputs
Every algorithm: what goes in, what you do, what comes out. Write them as a list before you draw anything.
Structure diagrams
A tree of boxes: the big problem on top, sub-problems below. That is decomposition on paper.
Flowcharts
Learn the shapes:
- Oval — start / stop
- Parallelogram — input / output
- Rectangle — process
- Diamond — decision (yes/no)
- Arrows show flow; a loop is an arrow going back
Pseudocode / OCR Exam Reference Language (ERL)
Paper 2 is not “must be Python”. OCR has a reference language. Close enough to Python that your brain can translate:
age = input("Age?")
if age >= 18 then
print("Adult")
else
print("Child")
endif
Count-controlled: for i = 0 to 9. Condition-controlled: while x < 10. Arrays: names[0]. Nested if / for is expected.
You will practise ERL on the programming lesson too — same language, more reps.
Trace tables
A trace table is a dry-run on paper: one column per variable (and sometimes output), one row per step.
x = 3
y = 0
while x > 0
y = y + x
x = x - 1
endwhile
| x | y | condition x>0 |
|---|---|---|
| 3 | 0 | true |
| 2 | 3 | true |
| 1 | 5 | true |
| 0 | 6 | false — stop |
Final y is 6. If you skip a row, the exam will catch you.
Errors and refining
- Syntax — breaks the rules of the language (
prnt, missingendif) - Logic — runs but wrong answer (off-by-one,
>instead of>=) - Runtime — crashes (divide by zero, file not found)
Refining: complete a half-written algorithm, correct a line, add a condition. Nesting means an if or a loop inside another.
2.1.3 Searching and sorting
You must step through, not only name.
Linear search
Look at each item in order until you find the target or run out.
- Works on unsorted data
- Worst case: n checks (the item is last or missing)
Binary search
Only on sorted data. Look at the middle. If the target is smaller, throw away the right half; if larger, throw away the left. Repeat.
- Far fewer checks on large lists
- If the list is unsorted, binary search is wrong — say so
Example: find 7 in 1 3 4 7 9 11 15. Mid is 7 — found in one hit. Find 2: mid 7, go left 1 3 4, mid 3, go left 1, not found.
Bubble sort
Compare neighbours, swap if out of order, pass through the list. Biggest values bubble to the end. Repeat until a pass with no swaps.
Slow on large lists. Easy to trace.
Insertion sort
Build a sorted left portion. Take the next item and insert it into the right place (shifting others). Like sorting cards in your hand.
Merge sort
Divide and conquer. Split the list in half until pieces are size 1. Merge sorted pairs into larger sorted lists.
More memory (temporary lists). Efficient on large data compared with bubble.
You should be able to show one pass of bubble, one insert of insertion, and one merge of two small sorted lists.
Exercises include a full trace. Skip to the quiz or another unit whenever you like.