Fundamentals of algorithms

    Master the core of problem-solving with the Fundamentals of Algorithms. This guide covers decomposition, abstraction, flowcharts, pseudocode, and trace tables—the essential tools you need to break down complex problems and secure top marks in your GCSE Computer Science exam.

    5
    Min Read
    3
    Examples
    5
    Questions
    6
    Key Terms
    🎙 Podcast Episode
    Fundamentals of algorithms
    0:00-0:00

    Study Notes

    Overview

    Header image for Fundamentals of Algorithms

    Algorithms are the beating heart of Computer Science. At their core, algorithms are simply precise, step-by-step instructions designed to solve specific problems. But mastering this topic is about more than just writing code; it's about developing a computational mindset. This topic introduces you to powerful problem-solving techniques like decomposition and abstraction, and teaches you how to represent your ideas clearly using flowcharts and pseudocode.

    Why does this matter? Because before you can write a successful computer program, you need a flawless logical plan. Examiners love testing this topic because it reveals whether you truly understand the logic behind the code. You can expect a mix of questions, from defining key terms to tracing the execution of complex algorithms using trace tables. By mastering these fundamentals, you are building the foundation for the entire programming section of your specification.

    Key Concepts

    Concept 1: Decomposition

    Decomposition is the process of breaking down a large, complex problem into smaller, more manageable sub-problems.

    Why does this work? Human brains struggle to hold massive amounts of complexity at once. By dividing a problem, you can tackle each small piece individually. In software development, this allows teams of programmers to work on different parts of a system simultaneously without stepping on each other's toes.

    Example: Imagine designing a school management system. That's a huge task! But if you decompose it, you get sub-problems: a system for attendance, a system for grades, a system for timetables, and a system for parent communication. Each of these is easier to design and code than the whole system at once.

    Concept 2: Abstraction

    Decomposition and Abstraction visualized

    Abstraction is the process of removing or hiding unnecessary detail so you can focus on the essential features of a problem.

    Why is this necessary? Because real-world problems are often messy and full of irrelevant data. If you tried to model every single physical property of a car in a racing game (like the exact molecular structure of the tires), the game would be too complex to run. Abstraction lets you say: "For this game, I only care about the car's speed, weight, and colour."

    Example: The classic example is the London Underground map. It doesn't show the exact geographical twists and turns of the tracks, nor the streets above. It abstracts all that away to show you only what you need to know: the stations and the lines connecting them.

    Concept 3: Representing Algorithms (Flowcharts and Pseudocode)

    Algorithms are not computer programs. They are the logical plan. To communicate this plan, we use specific representations.

    Flowcharts use visual symbols to show the flow of logic:

    • Oval/Rounded Rectangle: Start or End (Terminals)
    • Rectangle: Process (e.g., count = count + 1)
    • Diamond: Decision (e.g., is count > 10?). Crucially, this must have two exits: Yes and No.
    • Parallelogram: Input or Output (e.g., OUTPUT count)

    Pseudocode is a text-based representation that looks like a simplified programming language. It ignores the strict syntax rules of languages like Python or Java, focusing instead on the logic.

    Concept 4: Trace Tables

    Step-by-step Trace Table example

    Trace tables are a manual way to test an algorithm. You create a table with a column for each variable, and you track how the values change step-by-step as you mentally execute the algorithm.

    Why do we use them? To find logic errors before we ever write a line of code, or to determine the purpose of an unknown algorithm in an exam.

    Example: If an algorithm loops three times, adding 2 to a variable x (which starts at 0) each time, your trace table would show x changing from 0, to 2, to 4, to 6 on successive rows.

    Fundamentals of Algorithms Audio Revision

    Practical Applications

    These concepts aren't just for exams; they run the modern world.

    • Sat-Navs: Use abstraction (ignoring scenery to focus on roads) and algorithms (finding the shortest path) to get you home.
    • Search Engines: Use highly complex algorithms to sort billions of web pages in milliseconds.
    • Game Development: Uses decomposition to split work between physics engines, graphics rendering, and AI logic.

    Visual Resources

    2 diagrams and illustrations

    Decomposition and Abstraction visualized
    Decomposition and Abstraction visualized
    Step-by-step Trace Table example
    Step-by-step Trace Table example

    Interactive Diagrams

    2 interactive diagrams to visualise key concepts

    Conceptual Flow Outline

    Start
    Input User Age
    Input User Age
    Is Age >= 18?
    Is Age >= 18?
    "Yes"Output: Access Granted
    "No"Output: Access Denied
    Output: Access Granted
    End
    Output: Access Denied
    End

    A simple flowchart demonstrating a decision process using standard symbols.

    Conceptual Flow Outline

    Complex Problem: Build Video Game
    Sub-problem: Graphics Engine
    Sub-problem: Physics Engine
    Sub-problem: User Input
    Sub-problem: Audio System
    Sub-problem: Graphics Engine
    Render Textures
    Handle Lighting

    A decomposition diagram showing how a complex problem is broken into sub-problems.

    Worked Examples

    3 detailed examples with solutions and examiner commentary

    Practice Questions

    Test your understanding — click to reveal model answers

    Q1

    State the three essential properties that an algorithm must have. (3 marks)

    3 marks
    foundation

    Hint: Think about whether the steps can be misunderstood, if it ever stops, and if the steps are actually possible.

    Q2

    A student is writing a program to simulate a queue at a theme park ride. Describe how abstraction could be used in this simulation. (3 marks)

    3 marks
    standard

    Hint: What details about the people in the queue do not matter for calculating wait times?

    Q3

    Explain one advantage of using decomposition when designing a complex software system. (2 marks)

    2 marks
    standard

    Hint: Think about how teams of programmers work together.

    Q4

    Look at the following pseudocode:
    1 x <- 5
    2 y <- 10
    3 WHILE x < y DO
    4 x <- x + 2
    5 ENDWHILE
    6 OUTPUT x
    What will be output when this algorithm finishes executing? (2 marks)

    2 marks
    challenging

    Hint: Mentally trace the values of x. Does the loop run when x is 9? What does x become?

    Q5

    Draw the standard flowchart symbol used for a process, and the symbol used for a decision. (2 marks)

    2 marks
    foundation

    Hint: One is a simple box, the other is a jewel shape.

    Key Terms

    Essential vocabulary to know