Document a simple algorithm using a structured English description, a flowchart or pseudocode

9.2 Algorithms – Documenting a Simple Algorithm

This note shows how to document an algorithm using the three representation techniques required by the Cambridge International AS & A Level Computer Science (9618) syllabus:

  • Structured English
  • Flow‑chart
  • Pseudocode

It also demonstrates how to move between the representations, refine a high‑level description, handle edge cases, discuss efficiency, and link the activity to the relevant syllabus units and assessment objectives.


1. Example Problem (Unit 3 – Algorithms)

Task: Find the maximum value in a list of n positive integers.

1.1 Identifier Table

IdentifierTypePurpose
nintegerNumber of elements in the list
valueintegerCurrent element being examined
maxintegerLargest value found so far
iintegerLoop counter (controls iteration)


2. Structured English Description (with validation)

  1. Start.
  2. Read the number of elements n.
  3. If n = 0 then output “No data” and stop.
  4. Read the first element and store it in max.
  5. Set the counter i ← 2.
  6. Repeat while i ≤ n:

    • Read the next element into value.
    • If value > max then set max ← value.
    • Increment i ← i + 1.

  7. Output max as the largest number.
  8. Stop.


3. Flow‑chart (Unit 3 – Representations)

Standard flow‑chart using the recognised symbols (oval, parallelogram, rectangle, diamond). Replace the placeholder with a diagram when presenting to students.

Start

Read n

n = 0?

Output “No data”

Stop

Read value → max

i ← 2

i ≤ n?

Read value

If value > max → max ← value

i ← i + 1

Output max

Stop


4. Pseudocode (with annotations)

LineAction
1READ n