9.2 Algorithms

2026 Syllabus Objectives

By the end of this subtopic, you should be able to:

  • understand that an algorithm is a solution to a problem written as a sequence of clear, defined steps
  • use suitable identifier names for data in a problem and show them in an identifier table
  • write pseudocode that includes input, process, and output
  • write pseudocode using the three basic programming constructs: sequence, selection, and iteration
  • document a simple algorithm using structured English, a flowchart, or pseudocode
  • write pseudocode from a structured English description or a flowchart
  • draw a flowchart from structured English or pseudocode
  • describe and use stepwise refinement to develop an algorithm into enough detail to be programmed
  • use logic statements to define parts of an algorithm solution

What is an algorithm?

An algorithm is a method for solving a problem by following a series of clear steps in the correct order. Each step must be defined properly so that someone else, or a computer, can follow it without confusion.

Think of an algorithm like a recipe. A recipe tells you exactly what to do, step by step, to make food. In the same way, an algorithm tells you exactly what to do to solve a problem.

For example, if the problem is to find the area of a rectangle, the algorithm could be:

  1. Input the length
  2. Input the width
  3. Multiply length by width
  4. Output the area

This is an algorithm because it solves a problem using a sequence of defined steps.

A good algorithm should be:

  • clear
  • in the correct order
  • easy to follow
  • detailed enough to be turned into a program

Ways to document an algorithm

Before writing a real program, an algorithm is often written in one of three forms:

Structured English

Structured English is a simple way of describing an algorithm using normal English, but in a logical and ordered form. It is easy for humans to read.

For example:

  • Ask the user to enter a number
  • If the number is even, display “Even”
  • Otherwise, display “Odd”

Structured English is useful in the planning stage because it helps you think through the steps without worrying too much about formal syntax.

Pseudocode

Pseudocode is a more formal way of writing an algorithm. It looks a little like programming code, but it is not tied to one programming language.

Pseudocode is useful because it:

  • shows the logic clearly
  • is easier to convert into real program code
  • can be understood by people who know programming ideas

For example:

INPUT Number
IF Number MOD 2 = 0 THEN
    OUTPUT "Even"
ELSE
    OUTPUT "Odd"
ENDIF

Flowchart

A flowchart is a diagram that shows the steps of an algorithm using standard symbols and arrows. It is useful for showing the flow of control visually.

Common flowchart symbols include:

  • Oval for Start and Stop
  • Parallelogram for Input and Output
  • Rectangle for Process
  • Diamond for Decision
  • Arrows to show the direction of flow

A flowchart is especially helpful when you want to see how an algorithm branches or loops.

Sign in to view full notes