Learning Objectives
  • State the overall purpose of a given algorithm.
  • Describe the processes carried out by an algorithm in a logical order.
  • Distinguish purpose from a line-by-line translation.
  • Use inputs and outputs to support an explanation.
Key Terms
Algorithm
A finite sequence of unambiguous steps used to solve a problem.
Purpose
The overall task or result that an algorithm is intended to achieve.
Process description
An explanation of the main operations performed on the data.
Dry-run
Manually following an algorithm with chosen data.
Finite
Guaranteed to stop after a limited number of steps for valid use.
Unambiguous
Having one clear interpretation for each step.
Summary diagram
Summary Of The Main Ideas In This Lesson
What A Purpose Statement Should Contain

The purpose is a concise description of what the complete algorithm achieves. It should normally identify the main input or data set, the important operation and the output or decision.

For an algorithm that reads ten temperatures and displays the highest, a good purpose statement is: “It inputs ten temperature readings, finds the highest reading and outputs it.” Saying only “it processes temperatures” is too vague.

Describing Processes

A process description explains the important stages rather than translating every symbol mechanically. It may state that a total is initialised, values are repeatedly input and added, invalid values are rejected, an average is calculated and the result is displayed.

The order matters. If a maximum is updated before the next value is input, or an average is calculated inside the loop instead of after all values, the behaviour changes.

Recognising Common Patterns
Pattern In Algorithm Likely Process
Total starts at zero and each value is added Totalling
Count increases when a condition is true Conditional counting
Current value compared with stored largest Finding a maximum
Values compared one by one with a target Linear search
Adjacent values exchanged in repeated passes Bubble sort
Input repeated until a condition is satisfied Validation loop
Using Inputs And Outputs

Inputs help identify the subject of the algorithm. Outputs reveal the final result, but intermediate variables show how the result is produced.

An algorithm can have more than one output. It may display an error for invalid input and later display a calculated result. A purpose statement should focus on the main task while a process description can mention significant alternative paths.

Purpose Is Not A Trace

A trace shows exact variable values for particular data. A purpose explanation describes general behaviour for all suitable data. Do not include one set of numerical results unless the question asks for the output of a specific run.

Similarly, a purpose statement should not merely repeat variable names without interpreting them. “It changes X and Y” gives little understanding.

Method For Unfamiliar Algorithms
  • Identify every input.
  • Identify initial values and what they suggest.
  • Locate loops and determine what repeats.
  • Locate decisions and determine when each branch runs.
  • Identify variables that are updated.
  • Identify final outputs.
  • Summarise the overall task in one or two precise sentences.
Worked Examples
Conditional Count

Question: An algorithm inputs 20 ages, increases AdultCount when Age >= 18 and outputs AdultCount. State its purpose.

  1. The input is 20 age values.
  2. The repeated comparison tests adulthood.
  3. The counter records how many values meet the condition.
  4. The final output is the count.

Answer: The algorithm counts and outputs how many of the 20 people are aged 18 or over.

Distinguishing Purpose And Process

Question: How should the explanation differ for a bubble-sort algorithm?

  1. Purpose: arrange the list in a stated order.
  2. Process: repeatedly compare adjacent items and swap those in the wrong order until passes are complete or no swaps occur.

Answer: The purpose states the result; the process explains how the algorithm reaches it.

Examination Guidance
  • Use the data context in the question rather than only variable names.
  • State both the main operation and the result.
  • Describe loops as repeated actions and decisions as conditions.
  • Do not give a line-by-line translation unless specifically requested.
  • For a specified run, use a trace table rather than a general purpose statement.
Common Mistakes
  • Writing “the algorithm calculates something.”
  • Giving only the final output without the operation that produces it.
  • Describing one numerical run as the general purpose.
  • Ignoring validation or alternative branches that significantly affect the process.
  • Confusing a search that returns a position with a count of matching items.
Knowledge Check

1. What is the purpose of an algorithm?

Answer: The overall task or result the algorithm is intended to achieve.

2. How is a process description different?

Answer: It explains the main operations and control structures used to achieve the purpose.

3. What pattern suggests totalling?

Answer: A total initialised and repeatedly increased by each value.

4. Why examine outputs?

Answer: They help reveal the final result of the algorithm.

5. Should a purpose statement list every line?

Answer: No; it should summarise the complete behaviour precisely.