0% found this document useful (0 votes)
3 views

1.1 Representing Algorithms

The document provides an overview of key concepts in computational thinking, including algorithms, decomposition, and abstraction, which are essential for problem-solving in computer science. It explains how algorithms are step-by-step instructions for solving problems, while decomposition breaks down complex problems into manageable parts, and abstraction focuses on relevant details. Additionally, it discusses systematic approaches to problem-solving, the use of pseudocode and flowcharts, and the importance of identifying inputs, processes, and outputs in algorithms.

Uploaded by

annie.ali.blog
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

1.1 Representing Algorithms

The document provides an overview of key concepts in computational thinking, including algorithms, decomposition, and abstraction, which are essential for problem-solving in computer science. It explains how algorithms are step-by-step instructions for solving problems, while decomposition breaks down complex problems into manageable parts, and abstraction focuses on relevant details. Additionally, it discusses systematic approaches to problem-solving, the use of pseudocode and flowcharts, and the importance of identifying inputs, processes, and outputs in algorithms.

Uploaded by

annie.ali.blog
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

Head to www.savemyexams.

com for more awesome resources

AQA GCSE Computer Science Your notes

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, Decomposition & Abstraction


Your notes
Solving problems that can be implemented by a computer system is known as computational thinking
There are three main principles of computational thinking:
Algorithmic thinking
Decomposition
Abstraction

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

Examiner Tips and Tricks


Don't just memorise the definition of algorithmic thinking! In the exam, you will have to demonstrate
the skill by breaking a problem down into clear, step-by-step instructions (writing algorithms)
Algorithmic thinking takes practice, so the more you do, the easier it will become!

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

Each smaller problem can be solved independently of the others


Smaller problems can be tested independently Your notes
Smaller problems can be combined to produce a solution to the full problem
An examples of decomposition in computing is:
Computer games
Modern computer games are decomposed to break down the complexity of the problem into more
manageable 'chunks'
Creating an entire game at once would be challenging and inefficient, so it could be decomposed
into:
Levels - Levels can be designed/created/tested/ independently of other levels
Characters - The mechanics of characters in the game can be designed and created by a separate
team
Landscape - The art team can work on the visual aspects of the game without needing to
understand how the game is programmed
Once all of the smaller problems are completed, joined together a complex game has been created

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

Systematic Approach to Problem Solving


Your notes
When designing algorithms there are two main tools that can be used to describe them:
Pseudocode
Flowcharts

Examiner Tips and Tricks


Remember, in the exam you will be expected to create, interpret, correct and refine algorithms in
either flowcharts or AQA pseudocode

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]

[0] Dave Un1corn$

[1] George B@tman#1

[2] Elizabeth Coffee!!

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

[3] Henry Walking&123


Your notes
To iterate through the list, an algorithm would have to take a systematic approach to look for the
username entered by the user and then look in the column to the immediate right to find the password
for that user

Python code

users = [

["Dave", "Un1corn$"],

["George", "B@tman#1"],

["Elizabeth", "Coffee!!"],

["Henry", "Walking&123"]

# Ask the user for a name to search for


name_to_find = input("Enter a name to find: ")

# 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

password_to_check = input("Enter the password: ")

if password_to_check == users[i][1]:

print("Password correct. Access granted.")


break

else:

print("Incorrect password. Access denied.")


break

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:

print("Name not found.") Your notes

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()

IF age >= 18 THEN

PRINT("Welcome to the site")

ELSE

PRINT("Sorry, this site is for users 18 and over")

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()

IF age >= 18 THEN

PRINT("Welcome to the site + fname")

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

PRINT("Sorry, this site is for users 18 and over")

END IF Your notes

What are the AQA pseudocode rules?


AQA use a standard style for pseudocode which has been around for many years and that is seen in
AQA based exams to describe algorithms
Pseudocode has no official syntax so to keep exams consistent AQA have stuck with a common and
well-used format

Examples
Function AQA Pseudocode

OUTPUT print("Hello")

INPUT Fname ← INPUT()

SELECTION IF num == 2 then

...

ELSE IF num < 4 then

...

ENDIF

FOR LOOPS for i ← 1 to 10

...

ENDFOR

WHILE LOOPS while (i ≠ 11)

...

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

Examiner Tips and Tricks


AQA have a pseudocode guide for students and teachers to use which will match the pseudocode Your notes
in the exam papers.

Worked Example

Rewrite the flowchart as a pseudocode [4]


You must use Pseudocode
Answer

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

IF price < 50 THEN

OUTPUT "Great choice!" Your notes


ELSE

OUTPUT "Way too expensive"

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]

Console.Write num1 num2 output

else < > Else if

string double int

int num1;

________ num2;

Console.WriteLine("Enter a number: ");

num1 = int.Parse(Console.ReadLine());

Console.WriteLine("Enter another number: ");

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());

if (num1 > num2) Your notes


{

Console.WriteLine("________is bigger.");

else if (num1________num2)

Console.WriteLine("________is bigger.");

________

Console.WriteLine("The numbers are equal.");

Answer
int num1;

int num2;

Console.WriteLine("Enter a number: ");

num1 = int.Parse(Console.ReadLine());

Console.WriteLine("Enter another number: ");

num2 = int.Parse(Console.ReadLine());

if (num1 > num2)

Console.WriteLine("num1 is bigger.");

else if (num1 < num2)

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

else Your notes


{

Console.WriteLine("The numbers are equal.");

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

Algorithm Inputs, Processes & Outputs


Your notes
Algorithm Inputs, Processes & Outputs
Applying algorithmic thinking leads to a set of precise step-by-step instructions that can solve a
problem
To create an algorithm, the inputs, processes and outputs must be identified

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

Example 1 - Area of a shape

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

A user wants to write a program to calculate the area of a shape

Input Process Output Your notes

Length Length X width Area


Width

Example 2 - Average test score


A teacher wants to calculate the average mark achieved on a test amongst students in a class. The
teacher needs to enter how many students in the class and for each students a score out of 50

Input Process Output

Number of students TotalScore = TotalScore + score per student Average mark


Score per student Average = TotalScore / Number of students

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

Trace table walkthrough


Below is a flowchart to determine the highest number of ten user-entered numbers
The algorithm prompts the user to enter the first number which automatically becomes the highest
number entered
The user is then prompted to enter nine more numbers.
If a new number is higher than an older number then it is replaced
Once all ten numbers are entered, the algorithm outputs which number was the highest
Example test data to be used is: 4, 3, 7, 1, 8, 3, 6, 9, 12, 10

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

Trace table: Highest number


Your notes
Count Highest Number Output

1 Enter ten numbers

4 Enter your first number

2 3 Enter your next number

3 7 7

4 1

5 8 8

6 3

7 6

8 9 9

9 12 12

10 10 12 is your highest number

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

06 print (Y) Your notes

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

You might also like