Program flowcharts, trace tables and dry runs
Watch the whole lecture free
Make a free account to watch every lecture to the end: 5 practice questions, 2 real past-paper questions with the answers explained, the mistakes that lose marks, the full-marks tip, a one-card summary and a quick quiz.
That was the teaching part. The rest of this lecture is free with an account: 5 practice questions, 2 real past-paper questions with the answers explained, the mistakes that lose marks, the full-marks tip, a one-card summary and a quick quiz.
No password needed now: we email you a link to set one. Already have an account? Sign in, then come back to this page.
The teaching part (1 min) is free to watch. A free account opens the whole lecture: 5 practice questions, 2 real past-paper questions with the answers explained, the mistakes that lose marks, the full-marks tip, a one-card summary and a quick quiz.
What this lecture covers
- Drawing it and running it by hand
- Flowchart symbols
- Finding the smallest
Read the transcript of the teaching part
Last time
Before we start: last time, in Abstract data types, you learned these points. Here they are again on one card. Keep them in mind, because today builds on them.
Drawing it and running it by hand
Before you trust an algorithm, you can draw it as a flowchart, or run it by hand with a trace table. A flowchart shows the logic as a picture, with fixed shapes. A trace table shows what every variable holds as the algorithm runs. Both appear in nearly every Paper 2, and both are learned by following rules, not by guesswork.
Flowchart symbols
An oval is the start or end, labelled START or END. A rectangle is a process, such as an assignment or a calculation. A parallelogram is input or output. A diamond is a decision, with two exits labelled yes and no, or true and false. Arrows join the shapes and show the order. A loop is drawn as an arrow back to an earlier box.
Finding the smallest
Task: output the index of the smallest value in a 30-element array. Start. Set Min to 1, the index of the first element. Set I to 2. Decision: is I greater than 30? If yes, output Min and end. If no, decision: is Data[I] less than Data[Min]? If yes, set Min to I. Then I ← I + 1 and go back to the first decision. Every path must lead on. Label both exits of every diamond.
How often it comes up
How often Cambridge has asked each part, counted by ExamYard from every past paper in its question bank: Program flowcharts · Trace tables and dry runs.
The whole chapter: Flowcharts and Trace Tables.
Chapter 9: Algorithm design and problem-solving
- Abstraction, arrays, bubble sort and built-in functions 6 min
- Program flowcharts, trace tables and dry runs 5 min
Also for A Level Computer Science 9618
Which topics come up most in A Level Computer Science 9618 past papers, counted from every paper since 2004: Paper 1 topic frequency, Paper 2 topic frequency.