Revision Notes
Cambridge A Level Computer Science (9618): Algorithms (9.2) – Revision Notes
Condensed notes on identifier tables, loop choice, flowchart conversion, stepwise refinement and logic statements for Cambridge AS 9618 section 9.2.
- Subject
- Computer Science
- Level
- AS LEVEL
- Topic
- Topic 9: Algorithm Design and Problem-solving
- Author
- Marlbridge Academic Team
- Updated
- Reviewed by
- Harris Khan (what this means)
Aligned to Cambridge A Level Computer Science (9618), 2026. Official specification .
Syllabus page (what it covers and how it is assessed): Cambridge A Level Computer Science.
Syllabus points this page covers
9618 (AS Level)
- 9.2 Algorithms
Found an error? Report a correction.
Need help with this topic? Request a free trial class for A Level Computer Science (9618).
Quick-recall notes for 9.2 Algorithms (AS content, mainly Paper 2). The Algorithms study guide takes one problem through every skill; the Algorithms practice questions give exam-style practice. Section 9.1 is in the Computational Thinking Skills revision notes.
Definitions to quote
- Algorithm: a solution to a problem expressed as a sequence of defined steps.
- Identifier table: a table of the identifiers used, with each one’s data type and description.
- Stepwise refinement: breaking each step of an algorithm into more detailed steps, repeatedly, until each can be programmed directly.
- Logic statement: a condition built from comparisons and AND, OR, NOT that defines part of an algorithm.
Identifier names
- Meaningful:
TotalCost, notx. - No spaces; start with a letter.
- One consistent style (e.g. capital at the start of each word).
- Not a keyword (
INPUT,OUTPUT,FOR…). - Constants for fixed values:
CONSTANT VatRate = 0.2.
Input, process, output and the three constructs
| Construct | Pseudocode |
|---|---|
| Sequence | Statements one after another |
| Selection | IF ... THEN ... ELSE ... ENDIF; CASE OF Var ... OTHERWISE ... ENDCASE |
| Iteration | FOR Index ← 1 TO 10 ... NEXT Index; REPEAT ... UNTIL condition; WHILE condition ... ENDWHILE |
Assignment ←; comparison =, <>, <, <=, >, >=; join strings with &.
Choosing a loop
| Situation | Loop |
|---|---|
| Number of repetitions known in advance | FOR |
| Must run at least once (e.g. input until valid) | REPEAT … UNTIL |
| May run zero times (e.g. rogue value could come first) | WHILE … ENDWHILE |
Rogue value with WHILE: INPUT before the loop and at the end of the loop body.
REPEAT … UNTIL stops when the condition becomes TRUE; WHILE continues while it is TRUE.
Flowchart symbols
| Symbol | Meaning |
|---|---|
| Terminator (rounded) | START / STOP |
| Parallelogram | INPUT / OUTPUT |
| Rectangle | Process (assignment, calculation) |
| Diamond | Decision, two labelled exits |
| Arrow | Flow of control |
Converting between forms
| From → to | What to look for |
|---|---|
| Flowchart → pseudocode | A decision whose exit goes back up is a loop: tested before the body → WHILE; after → REPEAT … UNTIL. Exits that go down and rejoin → IF |
| Pseudocode → flowchart | One symbol per statement; every IF and loop condition becomes a diamond; WHILE/REPEAT need a loop-back arrow |
| Structured English → pseudocode | Keep the step order; each SET becomes ←, each REPEAT/WHILE/IF becomes the matching construct |
| Pseudocode → structured English | Short numbered instructions in plain words, same order |
Mini example: structured English to pseudocode
Structured English: 1. SET count to 0. 2. REPEAT 3 and 4 UNTIL the number entered is negative. 3. INPUT a number. 4. IF it is even and not negative, ADD 1 to count. 5. OUTPUT count.
Count ← 0
REPEAT
INPUT Num
IF Num MOD 2 = 0 AND Num >= 0 THEN
Count ← Count + 1
ENDIF
UNTIL Num < 0
OUTPUT Count
Step 4’s “not negative” becomes Num >= 0; without it, a rogue value such as −2 would be counted, because REPEAT processes the value before testing the UNTIL condition.
Stepwise refinement: pattern
Level 1: Produce a payslip
Level 2: 1 Get hours and rate 2 Calculate pay 3 Output payslip
Level 3: 2.1 Basic ← min(hours, 40) × rate
2.2 Overtime ← (hours − 40) × rate × 1.5 if hours > 40
2.3 Pay ← Basic + Overtime
Stop when each step maps onto one or two lines of code.
Logic statements
| Rule in words | Logic statement |
|---|---|
| Age from 13 to 19 inclusive | Age >= 13 AND Age <= 19 |
| Weekend | Day = "Sat" OR Day = "Sun" |
| Not a member | NOT Member or Member = FALSE |
| Under 5 or 65 and over | Age < 5 OR Age >= 65 |
Test each boundary with a value just inside and just outside.
Trace tables
- One column per variable, plus one for the condition if useful, plus OUTPUT.
- New row when a value changes.
- Record values only when they change; do not repeat unchanged ones unless the question’s table requires it.
Exam traps
=is comparison;←is assignment.- Missing the second INPUT in a WHILE loop gives an infinite loop.
- REPEAT … UNTIL always runs once, so a rogue value entered first is processed.
Mark >= 0 OR Mark <= 100is always TRUE; use AND.- Decision diamonds need both exits labelled (Yes/No or TRUE/FALSE).
- Keep the identifiers given in the question.
Self-test
- Define algorithm.
- What three columns does an identifier table have?
- Which loop is best for processing exactly 30 exam marks?
- Which loop should you use to keep asking until a valid PIN is entered?
- Why does a WHILE loop with a rogue value need two INPUT statements?
- On a flowchart, how do you tell a loop from a selection?
- Write a logic statement for “Score between 0 and 50 inclusive”.
- Write a logic statement for “Colour is red or blue”.
- What is stepwise refinement?
- When is stepwise refinement complete?
- Which flowchart symbol is used for OUTPUT?
- Give two features of a good identifier.
Answers
- A solution to a problem expressed as a sequence of defined steps.
- Identifier, data type, description.
- FOR (the count is known).
- REPEAT … UNTIL (must run at least once).
- One gives a value to test before the loop starts; one gets the next value at the end of each pass.
- A loop has a flow line from the decision going back to an earlier point; a selection’s paths go forward and rejoin.
Score >= 0 AND Score <= 50Colour = "Red" OR Colour = "Blue"- Breaking each step of an algorithm into more detailed steps, repeatedly.
- When each step is detailed enough to be programmed directly.
- Parallelogram.
- Any two: meaningful; no spaces; consistent style; not a keyword.
Related resources
-
Study guides
Cambridge A Level Computer Science (9618): Computational Thinking Skills
Abstraction and decomposition for Cambridge AS Computer Science 9618 9.1: producing an abstract model and breaking a problem into modules.
Computer Science · Cambridge · AS Level
Read guide -
Practice questions
Cambridge A Level Computer Science (9618): Computational Thinking Skills – Practice Questions
Original questions with mark-scheme answers on abstraction, abstract models, decomposition and modules for Cambridge AS Computer Science 9618.
Computer Science · Cambridge · AS Level
Try questions -
Revision notes
Cambridge A Level Computer Science (9618): Computational Thinking Skills – Revision Notes
Condensed notes on abstraction, abstract models, decomposition, procedures and functions for Cambridge AS Computer Science 9618 9.1, with a self-test.
Computer Science · Cambridge · AS Level
Revise topic
Get free revision emails (optional)
Occasional emails with practice questions, worked explanations and links to free resources for the qualification and subjects you choose. No spam, and you can unsubscribe from any email. The free tools on this site never need an email.