1.1 Representing Algorithms
1.1 Representing Algorithms
Representing Algorithms
Contents
Algorithms, Decomposition & Abstraction
Systematic Approach to Problem Solving
Algorithm Inputs, Processes & Outputs
Tracing Algorithms
Page 1 of 25
© 2015-2025 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
Algorithms
What are algorithms?
Algorithms are a set of step-by-step instructions in order to produce a solution to a problem
Algorithmic thinking requires the use of abstraction and decomposition to identify each step
Once each step has been identified, a precise set of rules (algorithm) can be created and the problem
will be solved
An example of algorithmic thinking is following a recipe, if the recipe is followed precisely it should lead
to the desired outcome
A set of traffic lights is an example of how algorithmic thinking can lead to solutions being automated
Decomposition
What is decomposition?
Decomposition is the process of breaking down a large problem into a set of smaller problems
Benefits of decomposition are:
Smaller problems are easier to solve
Page 2 of 25
© 2015-2025 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
Abstraction
What is abstraction?
Abstraction is the process of removing unnecessary details from a problem to focus on the important
features for implementing a solution
Examples of abstraction include modelling a real-life object, environment, action, sequence of actions
or concept.
Implementations of these include:
a computer game that simulates playing a sport
a simulator such as a car or flight simulator,
a map of a bus or train route in a city
When creating a program, developers must identify important features that will contribute to solving
the problem or have a role to play in the solution
Computer games
Page 3 of 25
© 2015-2025 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
Your notes
Computer games use a large amount of abstraction, removing the elements that a user does not
need to consider in order to enjoy playing the game
When using abstraction in computer games which are designed to simulate real life, the aim is to make
the game realistic and visually appealing whilst keeping the game fun to play
In a game that simulates a sport, it is important to the user that visually they recognise the environment
and when they perform an action, they see a response
However, users do not need to know the complex algorithms used to control the non player characters
(NPCs)
Train map
Page 4 of 25
© 2015-2025 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
Your notes
Page 5 of 25
© 2015-2025 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
Your notes
Another specific example of abstraction would be the London underground train route map; travellers
do not need to know the geographical layout of the routes, only that getting on at stop A will
eventually transport you to stop B
Worked Example
Jack plays rugby at his local rugby club. He wants to create a program to store the results of each
rugby match they play and the names of the try scorers.
Define what is meant by abstraction [2]
Give one example of how abstraction could be used when developing this program [1]
Answer
Abstraction is removing unnecessary detail from a problem in order to focus on the parts of the
problem that need solving
Simplifies the problem // reduces complexity // easier to solve
Any suitable example of abstraction as long as it is relevant to the system
Examples of what to ignore/hide/remove:
Time the try was scored
Player shirt number
Venue
Examples of parts to focus on:
Player name
Match result
Tries scored
Page 6 of 25
© 2015-2025 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
Systemic Approach
What is a systematic approach to problem solving?
A systematic approach means being able to take a logical approach and use algorithmic thinking to
solve a problem
Some examples of systematic approaches include:
Solving a word search puzzle
Finding an item within a list
A good example of a systematic approach would be a program used to find a username and the
matching password in a 2D list
In the example below, the 2D list has column 0 which stores the username and column 1 which stores
the password
[0] [1]
Page 7 of 25
© 2015-2025 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
Python code
users = [
["Dave", "Un1corn$"],
["George", "B@tman#1"],
["Elizabeth", "Coffee!!"],
["Henry", "Walking&123"]
# Search for the name in the first column of the list of users
found = False
for i in range(len(users)):
if name_to_find == users[i][0]:
found = True
if password_to_check == users[i][1]:
else:
Page 8 of 25
© 2015-2025 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
if found == False:
Pseudocode
What is pseudocode?
Pseudocode is a text based tool that uses short English words/statements to describe an algorithm
Pseudocode is more structured than writing sentences in English, but is very flexible
Example
A casino would like a program that asks users to enter an age, if they are 18 or over they can enter the
site, if not then they are given a suitable message
Pseudocode
Age ← INPUT()
ELSE
END IF
The casino would like the algorithm refined so that the user also enter their first name and this is used
to greet the user when they access the site
Pseudocode
Fname ← INPUT()
Age ← INPUT()
ELSE
Page 9 of 25
© 2015-2025 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
Examples
Function AQA Pseudocode
OUTPUT print("Hello")
...
...
ENDIF
...
ENDFOR
...
ENDWHILE
Page 10 of 25
© 2015-2025 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
Worked Example
Pseudocode
INPUT price
Page 11 of 25
© 2015-2025 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
END IF
Program Code
Program code, unlike the generic pseudocode, is specific to a programming language
The accepted languages you can answer questions in are:
C#
Python (version 3)
VB.NET
Exam questions will indicate the form of response expected, for example, pseudocode, program code
or a flowchart
Worked Example
A programmer has written a C# program that asks the user to input two integers and then output
which of the two integers is the largest. Complete the program by filling in the gaps using the
information below. Each item in the table 3 should only be used once. [5]
int num1;
________ num2;
num1 = int.Parse(Console.ReadLine());
Page 12 of 25
© 2015-2025 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
num2 = int.Parse(Console.ReadLine());
Console.WriteLine("________is bigger.");
else if (num1________num2)
Console.WriteLine("________is bigger.");
________
Answer
int num1;
int num2;
num1 = int.Parse(Console.ReadLine());
num2 = int.Parse(Console.ReadLine());
Console.WriteLine("num1 is bigger.");
Console.WriteLine("num2 is bigger.");
Page 13 of 25
© 2015-2025 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
Flowcharts
What is a flowchart?
Flowcharts are a visual tool that uses shapes to represent different functions to describe an
algorithm
Flowcharts show the data that is input and output, the processes that take place and any decisions or
repetition
Lines are used to show the flow of control
Example
Page 14 of 25
© 2015-2025 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
Flowchart
Your notes
Page 15 of 25
© 2015-2025 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
The casino would like the algorithm refined so that the user also enter their first name and this is used
to greet the user when they access the site
Your notes
Flowchart
Page 16 of 25
© 2015-2025 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
Your notes
Page 17 of 25
© 2015-2025 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
Your notes
Page 18 of 25
© 2015-2025 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
What is an input?
An input is data or information being entered/taken into a program before it is processed in the
algorithm
An input can come from a variety of sources, such as:
User - keyboard, mouse, controller, microphone
Sensors - temperature, pressure, movement
What is a process?
A process is a doing action performed in the algorithm that transforms inputs into the desired output.
The central processing unit (CPU) executes the instructions that define the process
An example would be:
Comparing two numbers
Calculating an average
What is an output?
An output is the result of the processing in an algorithm and usually the way a user can see if an
algorithm works as intended
An output can take various forms, such as:
Numbers - result of calculations
Text
Images
Actions - triggering events
Page 19 of 25
© 2015-2025 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
Worked Example
A bus company offers a discount to passengers if they have a valid 'student' card or are over 65
years of age.
Identify all the inputs that will be required in an algorithm to solve this problem [2]
Answer
Student card (YES/NO)
Age (integer)
Page 20 of 25
© 2015-2025 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
Tracing Algorithms
Your notes
Tracing Algorithms
What is a trace table?
A trace table is used to trace through an algorithm and to test algorithms and programs for logic
errors that appear when an algorithm or program executes
Trace tables can be used with flowcharts, pseudocode or program code
A trace table can be used to:
Discover the purpose of an algorithm by showing output data and intermediary steps
Record the state of the algorithm at each step or iteration
Each stage of the algorithm is executed step by step.
Inputs, outputs, variables and processes can be checked for the correct value when the stage is
completed
Page 21 of 25
© 2015-2025 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
Your notes
Page 22 of 25
© 2015-2025 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
3 7 7
4 1
5 8 8
6 3
7 6
8 9 9
9 12 12
Worked Example
01 X=5
02 Y=3
03 while X > 0
04 Y=Y+6
Page 23 of 25
© 2015-2025 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
05 X=X-1
Complete the following trace table for the given algorithm, the first two lines have been filled in for
you
Answer
Page 24 of 25
© 2015-2025 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
Your notes
Page 25 of 25
© 2015-2025 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers