Worked solution from the Computational thinking and Problem-solving Paper 3 Advanced Theory booklet, Part 1 of 2.
Dijkstra: give Start 0 and every other node infinity. Always visit the unvisited node with the smallest distance, then update its neighbours.
| Visit | Distance found |
|---|---|
| Start 0 | A = 8, F = 10 |
| A 8 | B = 12 |
| F 10 | C = 19, E = 17 |
| B 12 | D = 14, C = 20 (not better than 19) |
| D 14 | E = 16 (better than 17) |
| E 16 | C = 19 (same as before) |
| C 19 | all done |
Start set to 0 and the other nodes set to infinity [1]
Values updated and visited nodes shown [1]
More than one route worked out for a node and the shortest kept (for example E via F is 17, via D is 16) [1]
Write the shortest distance from Start:
| A | B | C | D | E | F |
|---|---|---|---|---|---|
| 8 | 12 | 19 | 14 | 16 | 10 |
All six values correct [2]
Four or five values correct earns 1 mark instead.
▶ Whole paper
Video solution of the whole paper · by TEACHING BY SM. Tap the picture to open it on YouTube.
Solutions follow the official Cambridge mark schemes; marks are shown in grey. Videos are from other YouTube channels. Paper codes read component / series / year: M/J = May/June, O/N = October/November. Past-paper questions © UCLES, reproduced for classroom practice.