7.3 Explaining the purpose of an algorithm

← Topic 7.2 Computer systems, sub-systems and decompositionComputer Science contentsTopic 7.4 Standard methods of solution →
Chapter 7 · Algorithm design and problem solving

7.3 Explaining the purpose of an algorithm

An algorithm sets out the steps needed to complete a task. Topic 7.3 focuses on reading a flowchart or pseudocode and explaining both the overall purpose of the algorithm and the individual processes used to achieve that purpose.

Algorithm purposeProcessesFlowchartsPseudocodeTracing

Explaining what an algorithm does

An algorithm is a sequence of steps used to complete a given task. The source shows algorithms in two familiar forms: flowcharts and pseudocode. When you study an algorithm, you should be able to identify:

What to identifyMeaning
PurposeThe overall task or result the algorithm is intended to achieve.
ProcessesThe individual actions and checks carried out to achieve that purpose.

The aim is not only to recognise individual statements. You need to connect the steps together so you can explain what the whole algorithm is doing.

Check how to identify purpose and processes.

Textbook example: output an alarm sound

The textbook example has one clear purpose: output the alarm sound at the appropriate time. It does this by repeatedly checking the current time until it matches the stored alarm time.

REPEAT
  Wait (10)
  Get (Time)
UNTIL Time = Alarm_Time
OUTPUT AlarmSound

The processes are:

Exam approach: state the overall purpose first, then describe the main processes in the order in which they happen.
Check the alarm algorithm.

Reading the same algorithm as a flowchart and pseudocode

Activity 7.6 shows the same algorithm in two forms. Both versions input two numbers, compare them, and output the larger value.

Figure 7.11 Flowchart and pseudocode for comparing two numbers
Figure 7.11 Flowchart and pseudocode

The decision is Num1 > Num2. If this is true, the first number is printed as the largest. Otherwise, the second number is printed as the largest.

Tracing the textbook values

If Num1 = 7 and Num2 = 18, the test 7 > 18 is false. The algorithm follows the no/ELSE path and outputs:

18 is largest
Check that you can identify the purpose and trace the comparison.

Topic 7.3 revision checklist

Define an algorithm as a sequence of steps used to complete a task.
Recognise that an algorithm can be represented using a flowchart or pseudocode.
State the overall purpose of a given algorithm.
Identify the processes used by the algorithm.
Follow decisions and determine which path is taken.
Trace given input values to determine the output.
Recognise when two different representations describe the same algorithm.
Ready for a mixed Topic 7.3 check?
← Topic 7.2 Computer systems, sub-systems and decompositionComputer Science contentsTopic 7.4 Standard methods of solution →