GCSE Revision Aid: This resource is designed to support your revision and may contain errors. If you find a discrepancy with your class teaching, your teacher is correct — please let us know at gcserevise@scott.scottrix.co.uk.

CS1: Representing Algorithms

Foundation Higher AQAEdexcelOCREduqasCCEA

How to write and represent algorithms using pseudo-code, flowcharts, decomposition, and abstraction.

Fastmail

📋 What is an Algorithm?

Definition: An algorithm is a step-by-step set of instructions that solves a specific problem. It must be finite, unambiguous, and produce a correct result for all valid inputs.

Algorithms can be represented in several ways:

Key Principle:
An algorithm must be:
Finite - it has a definite end
Unambiguous - each step has exactly one meaning
Input - it has defined inputs (zero or more)
Output - it produces at least one output
Correct - it solves the problem for all valid inputs

📝 Pseudo-code Conventions

Pseudo-code is not a real programming language. It uses structured English with programming constructs to describe algorithms without worrying about syntax rules.

Assignment

Assignment Example
name ← "Alice"
age ← 16
total ← price * quantity

Selection (IF/ELSE)

IF/ELSE Example
IF age >= 18 THEN
    OUTPUT "You can vote"
ELSE
    OUTPUT "You cannot vote"
ENDIF

Iteration (FOR loop)

FOR Loop Example
FOR counter ← 1 TO 10
    OUTPUT counter
NEXT counter

Iteration (WHILE loop)

WHILE Loop Example
WHILE password <> "secret"
    INPUT "Enter password: ", password
ENDWHILE

Iteration (REPEAT loop)

REPEAT UNTIL Example
REPEAT
    INPUT "Enter age (1-120): ", age
UNTIL age >= 1 AND age <= 120

Input and Output

I/O Example
INPUT "Enter your name: ", name
OUTPUT "Hello " & name
Construct Pseudo-code Syntax Purpose
Assignment variable ← value Store a value in a variable
Input INPUT prompt, variable Get data from the user
Output OUTPUT expression Display data to the user
Selection IF...THEN...ELSE...ENDIF Make a decision
Counted loop FOR...TO...NEXT Repeat a set number of times
Condition loop WHILE...ENDWHILE Repeat while condition is true
Post-test loop REPEAT...UNTIL Repeat until condition is true

🔀 Flowchart Symbols

Flowcharts use standard symbols to represent different types of operations in an algorithm. Each symbol has a specific meaning.
Name Shape Purpose Example Content
Terminator Oval / Rounded rectangle START and END of the algorithm START, STOP
Process Rectangle Calculations, assignments, operations total ← total + 1
Decision Diamond Yes/No or True/False questions Is age >= 18?
Input/Output Parallelogram Getting input or producing output INPUT name, OUTPUT result
Flow lines Arrows Show the direction of flow Arrows connecting symbols

Flowchart Example

Checking if a number is positive
START
  |
INPUT number
  |
IS number >= 0?
  |-- YES --> OUTPUT "Positive or zero"
  |-- NO  --> OUTPUT "Negative"
  |
STOP
Flowchart Rules:
Every flowchart must have exactly one START and at least one STOP
Decision boxes must have exactly TWO exits (Yes and No)
Flow lines must connect symbols in the correct order
Flow direction should be top-to-bottom and left-to-right
All flow lines must have arrows showing direction

🧩 Decomposition

Decomposition means breaking down a complex problem into smaller, more manageable sub-problems. Each sub-problem can be solved independently and then combined to solve the original problem.

Why Decompose?

Decomposition Example: Making a Quiz Game

Big problem: Create a quiz game

Sub-problems:

  • 1. Store the questions and answers
  • 2. Display a question to the user
  • 3. Get the user's answer
  • 4. Check if the answer is correct
  • 5. Update the score
  • 6. Check if the quiz is finished
  • 7. Display the final score
Decomposition Example: Student Registration System

Big problem: Build a student registration system

Sub-problems:

  • 1. Input student personal details
  • 2. Validate the data entered
  • 3. Assign a unique student ID
  • 4. Store data in a database
  • 5. Generate a confirmation message

🔮 Abstraction

Abstraction means removing unnecessary detail from a problem so you can focus on what matters. You include only the essential information needed to solve the problem and ignore everything else.

Why Use Abstraction?

Abstraction Example: Weather Map

Full reality: A real landscape has buildings, people, animals, trees, roads, rivers...

Abstracted version (weather map): Only shows temperature, rainfall, wind direction - everything else is removed because it is not relevant to weather forecasting.

Abstraction Example: London Underground Map

The tube map does not show exact geographical positions or distances. It abstracts away these details and only shows the order of stations and interchange points, which is what passengers actually need.

Real World Abstracted Model Removed Detail
Physical road network Graph of nodes and edges Road surface, width, scenery
A football match Score, time, teams Individual player movements, crowd noise
A school Student records system Building layout, uniform colour

📥 Identifying Inputs, Processing and Outputs

Every algorithm can be analysed in terms of its inputs (what goes in), processing (what happens to it), and outputs (what comes out). Identifying these is the first step in designing any algorithm.
Input - Process - Output (IPO)
1. What data do I need? (INPUTS)
2. What do I need to do with it? (PROCESSING)
3. What should the result be? (OUTPUTS)
IPO Example: Calculating Average

Problem: Calculate the average of three test scores

ComponentDescription
InputThree test scores (score1, score2, score3)
ProcessingAdd the three scores together, divide by 3
OutputThe average score
INPUT score1
INPUT score2
INPUT score3
total ← score1 + score2 + score3
average ← total / 3
OUTPUT average
IPO Example: Password Checker

Problem: Check if a password is at least 8 characters long

ComponentDescription
InputA password string
ProcessingFind the length of the password, compare to 8
OutputWhether the password is valid or not
INPUT password
IF LENGTH(password) >= 8 THEN
    OUTPUT "Password accepted"
ELSE
    OUTPUT "Password too short"
ENDIF

⚖️ Decomposition vs Abstraction

Feature Decomposition Abstraction
What it does Breaks a problem into smaller parts Removes unnecessary detail
Goal Make each part manageable Focus on essentials only
Result Multiple sub-problems A simplified model
Example Splitting a game into graphics, logic, input Representing a city as just coordinates
When to use Complex problems with many parts Problems with too much irrelevant detail

❓ Practice Questions

Q1: What shape is used in a flowchart to represent a decision?

Q2: Write pseudo-code that asks the user for a number and outputs "Even" if it is divisible by 2, or "Odd" if it is not.

Q3: Explain the difference between decomposition and abstraction.

Q4: A program needs to calculate the area of a rectangle. Identify the inputs, processing and outputs.

Q5: Decompose the problem of creating an online shopping system into at least four sub-problems.

✅ Answers

  1. A diamond shape is used to represent a decision in a flowchart.
  2. INPUT number
    IF number MOD 2 = 0 THEN
        OUTPUT "Even"
    ELSE
        OUTPUT "Odd"
    ENDIF
  3. Decomposition breaks a complex problem into smaller sub-problems that can be solved independently. Abstraction removes unnecessary detail so you can focus on what is essential to solve the problem.
  4. Inputs: length and width of the rectangle. Processing: multiply length by width. Output: the area of the rectangle.
  5. Sub-problems: 1) Browse/search products, 2) Add items to basket, 3) Process payment, 4) Manage delivery details, 5) Handle user accounts.

🎯 Exam Tips

⚠️ Common Errors

✗ Using = instead of ← for assignment in pseudo-code ✓ In pseudo-code, use the left-arrow ← for assignment; = is used for comparison in conditions.

✗ Thinking pseudo-code must follow exact Python/Java syntax ✓ Pseudo-code is language-independent structured English; it describes logic without strict syntax rules.

✗ Forgetting that flowchart decision boxes must have exactly two exits ✓ Every diamond (decision) must have exactly two paths: Yes and No. A decision with one exit is invalid.

✗ Confusing decomposition with abstraction ✓ Decomposition breaks a problem into smaller sub-problems; abstraction removes unnecessary detail to simplify.

✍️ Model Answer

Full-Mark Response

A teacher wants to create an algorithm to calculate the average test score for a class of 30 students. Explain how you would use decomposition and abstraction to design this algorithm. [6 marks]

Decomposition: I would break the problem into sub-problems: (1) Input each student's score, (2) Calculate the total of all scores, (3) Divide the total by 30 to find the average, (4) Output the result. Abstraction: I would remove unnecessary details such as student names, the subject of the test, and the date — only the numeric scores are needed to calculate an average. I would also assume all 30 students took the same test, ignoring any absent students. By decomposing, each sub-problem can be solved and tested independently. By abstracting, the algorithm focuses only on the essential data (scores) and ignores irrelevant information.

📊 AO Deep Dive

Assessment Objective Analysis

AO1 (Computational Thinking — 40%): Demonstrate knowledge and understanding of the principles and concepts of computer science, including representing algorithms, pseudo-code and flowcharts for AQA 8525, OCR J277 & Edexcel 1CP2.

AO2 (Application — 40%): Apply knowledge and understanding of computer science, including representing algorithms, pseudo-code and flowcharts to analyse problems in computational terms and to design, write and evaluate solutions.

AO3 (Evaluation — 20%): Evaluate the effectiveness, correctness and efficiency of computational solutions, including representing algorithms, pseudo-code and flowcharts, and make reasoned judgements about trade-offs.

📝 Exam Technique

GCSE Computer Science Exam Tips:
When writing pseudo-code, always use the correct keywords (IF, THEN, ELSE, ENDIF, WHILE, ENDWHILE, FOR, TO, NEXT). Use ← for assignment, not =. For flowchart questions, draw each symbol carefully — ovals for START/STOP, rectangles for processes, diamonds for decisions, parallelograms for I/O. Decision diamonds must have exactly two exits (Yes/No). In decomposition questions, break into at least 3-4 sub-problems. For abstraction, always state WHAT detail is removed and WHY it is unnecessary.

📝 Exam Questions by Topic

🎬 Video Resources

Share this page

Ready to ace your GCSE Computer Science exams?

Get the best revision books and guides to boost your grades.