GCSE Computer Science
Learn about algorithms and computational thinking.
Understand what algorithms are and how to represent them using flowcharts and pseudocode. Explore searching algorithms (linear and binary search) and sorting algorithms (bubble sort, merge sort).
This unit covers algorithm efficiency, abstraction, decomposition, and pattern recognition - key concepts in computational thinking.
⚠️
AI-Generated Content - Not Yet Reviewed
This lesson content has been partially generated using AI and has not yet been reviewed by a human educator. It likely contains numerous issues, inaccuracies, and pedagogical problems. Do not use this content for actual lesson planning or teaching at this time.
How would you explain making a cup of tea to an alien who has never seen a kitchen?
Present the scenario: An alien has arrived and wants to understand how humans make tea. They've never seen a kettle, cup, tea bag, or even water. Students work in pairs for 2 minutes to write instructions. Share some examples - they'll be hilariously over-complicated or miss obvious steps. Use this to introduce why we need systematic ways to break down problems.
Resources:
Fun cartoon alien looking confused at a kettle
Teacher Notes:
The humour of failed instructions is the point. Students naturally discover why 'fill the kettle' isn't specific enough - what IS a kettle? Where do you get water? How much? This sets up decomposition beautifully.
Introduce each principle with a relatable example:
Decomposition: Show a complex task (planning a school trip) and break it into sub-tasks (transport, permissions, activities, food, first aid). Like taking apart a LEGO set to see the individual bricks.
Abstraction: Using the London Tube map as the classic example - it removes geography, scale, and surface details to show only what matters (stations and lines). Students identify what was removed and why.
Algorithmic Thinking: The recipe analogy - turning a problem into step-by-step instructions that anyone could follow. Show how our alien tea instructions are an algorithm.
Resources:
Classic Beck-style Tube map
Showing same stations on actual geography for comparison
Visual showing decomposition of trip planning
Teacher Notes:
The Tube map is an iconic example of abstraction that students will remember. Have them identify 3 things that were 'abstracted away' (actual distances, curves in tunnels, above-ground geography).
Groups of 3-4 receive a complex task card (e.g., 'Organise a birthday party', 'Create a mobile app', 'Run a school football tournament'). They must decompose it into at least 6 sub-tasks, then pick ONE sub-task and decompose it further. Groups share their decompositions. Discuss: at what point do you stop breaking things down?
Resources:
Laminated cards with complex scenarios appropriate for teenagers
Large paper or whiteboard template for visual breakdown
Teacher Notes:
Listen for groups going to different 'depths'. Someone decomposing 'send invitations' into 'design invitation → print → address envelope → add stamp → post' is going deeper than 'tell friends'. Both are valid - discuss when you'd need more detail.
Quick individual task: Students draw a simplified map showing how to get from the school entrance to this classroom. They must decide what to include (which corridors, doors, stairs) and what to abstract away (every single classroom, bathroom locations, fire extinguishers). Compare a few - why did different people include different details? The PURPOSE of the abstraction determines what's relevant.
Resources:
For quick sketching
Teacher Notes:
Some students will draw elaborate floor plans, others will draw 'go up stairs, turn left'. Neither is wrong - it depends on who's using the map and why. A visitor needs different detail than a cleaner.
Brief, inspiring aside: Show how Minecraft procedurally generates worlds using algorithmic thinking, and how games like FIFA decompose a football match into component systems (physics, AI, graphics, sound). Link to careers: Game designers, UX designers, project managers all use these skills.
Teacher Notes:
Keep this punchy and inspiring. The goal is to show these aren't just exam terms - they're real professional skills.
Students write definitions of abstraction, decomposition, and algorithmic thinking - but each definition can only be THREE WORDS (e.g., 'hiding unnecessary details', 'breaking things down', 'step-by-step instructions'). Share and vote on the best ones. Exit ticket: Which computational thinking principle would help most with homework organisation?
Teacher Notes:
The three-word constraint forces precision. Display the best ones for revision. The homework question checks they can apply concepts to new situations.
Computational thinking isn't just for programmers. Doctors use it to diagnose patients (decomposing symptoms), architects use abstraction when creating blueprints, and event planners use algorithmic thinking to coordinate complex schedules. Even Netflix uses these principles to recommend what you should watch next.
Connection: Shows students that computational thinking is a transferable life skill, not just an exam topic. Makes the abstract concepts concrete and valuable.
Further Reading:
Brief exploration of how video game developers decompose massive projects like FIFA or Minecraft into manageable components, and how they abstract away complexity so players don't need to understand physics engines to enjoy the game.
Connection: Games are relatable to students and demonstrate all three computational thinking principles in action.
Further Reading:
Support:
Stretch:
Every app on your phone is just a machine that takes something IN, does something WITH IT, and spits something OUT. But what exactly goes where?
Show a video or animation of a vending machine. Ask students: What's the INPUT? (money, button press) What's the PROCESS? (check money, release item) What's the OUTPUT? (snack, change). Now apply to Instagram: INPUT = photo + filters + caption, PROCESS = compress, store, distribute to followers, OUTPUT = post visible to everyone. The IPO model is everywhere.
Resources:
Simple animation showing the IPO stages
Teacher Notes:
Get students calling out answers. This should feel obvious - that's the point. We're giving them language for something intuitive.
Formal introduction to IPO with multiple examples:
Emphasise: The same problem can have different valid IPO descriptions depending on what level of detail you're working at.
Resources:
Blank templates for students to complete
Teacher Notes:
The traffic light example is good for showing that inputs can be from sensors, not just humans. Ask: What would be the input to a motion-sensing light?
Show how decomposition can be visualised using structure diagrams (also called hierarchy charts). Start with 'Make a Video Game' at the top, decompose into Graphics, Sound, Gameplay, User Interface. Decompose Gameplay further into Player Controls, Enemy AI, Scoring System. Explain: the diagram shows WHAT needs to be done, not HOW or in what ORDER (that comes later with algorithms).
Resources:
Pre-made example showing hierarchical breakdown
How to lay out boxes and connecting lines
Teacher Notes:
Compare to a company organisation chart - CEO at top, departments below, teams below that. Same principle. Students often want to show sequence - remind them structure diagrams show COMPONENTS, not STEPS.
Pairs receive scenario cards and must identify inputs, processes, and outputs. Scenarios increase in difficulty:
Share and discuss - especially the harder ones where there's genuine debate about what counts as an input.
Resources:
Laminated scenario cards of varying difficulty
Three-column sheet for answers
Teacher Notes:
The YouTube recommendation one is deliberately tricky - inputs include watch history, pause/skip behaviour, time of day, what's trending, etc. Let students discover this complexity.
Students create a structure diagram for 'Run a School Canteen' or 'Organise a Music Festival' (their choice). Must include at least 3 levels of decomposition. Work individually first, then compare with a partner - did they decompose in the same way? Discuss: there's rarely ONE correct decomposition.
Resources:
Space for diagram creation
Teacher Notes:
Circulate and push for detail: 'You said Prepare Food - what goes into that?' Accept different valid structures but question anything that doesn't make logical sense.
Quick-fire questions testing understanding:
Exit question: What inputs, processes, and outputs would a game like Wordle have?
Teacher Notes:
The Wordle question makes good homework - there's more complexity than students might initially think (tracking guesses, colour-coding letters, counting attempts, checking against word list).
Data scientists use the IPO model constantly: input (raw data from millions of users), process (machine learning algorithms), output (predictions like 'you might also like...'). This is how TikTok decides what videos to show you and how banks detect fraud.
Connection: Shows that IPO isn't just a classroom model - it's how billion-pound tech companies structure their thinking.
Further Reading:
Companies like Amazon use structure diagrams to map their entire logistics operation - from the moment you click 'buy' to the package arriving. Understanding inputs, processes, and outputs is a key business skill.
Connection: Demonstrates that structure diagrams are used professionally, not just academically.
Support:
Stretch:
YouTube video explaining hierarchy charts
Prerequisites: 1
Before there was code, there were flowcharts. NASA used them to plan the Moon landing. Could you draw one clear enough to save an astronaut's life?
Show the famous NASA Mission Control room photo. Explain: Before any code was written for Apollo 11, everything was planned using flowcharts. Show a (simplified) example of a NASA-era flowchart. Challenge: Could students draw instructions clear enough that Mission Control could follow them? Today, they'll learn how.
Resources:
Classic 1969 Apollo Mission Control photo
Declassified/simplified flowchart from space program
Teacher Notes:
This sets flowcharts up as serious, professional tools - not just an exam exercise. The pressure of 'clear enough to save lives' adds stakes.
Introduce each symbol with examples:
Demonstrate building a simple flowchart live: 'Is this number positive, negative, or zero?'
Resources:
One-page reference showing all symbols
Complete flowchart to demonstrate
Teacher Notes:
Emphasise the parallelogram is for input/output, not just 'things' - a common error. Decision diamonds MUST have two clear exit paths labelled Yes/No or True/False.
Give students three flowcharts to trace through. For each, they determine the output given specific inputs:
Work through first one together, then independent practice. Share and check answers.
Resources:
Three flowcharts with input values and space for working
Teacher Notes:
Common error: not following arrows correctly, especially with loops. Watch for students who 'jump' to the end without tracing properly.
Students create a flowchart for: 'Decide if someone can ride a rollercoaster based on height (must be at least 140cm)'. Must include: Start, input (height), decision, outputs for both paths, End. Then extend: Add a second check - are they feeling unwell?
Students draw on paper or use digital tool (Lucidchart/Draw.io have free tiers).
Resources:
Dotted paper or symbol stencil
Free online flowchart tool
Teacher Notes:
Circulate and check: Are arrows clear? Are decision outcomes labelled? Is there definitely one Start and one End? Common mistake: forgetting to show output in both decision branches.
Present three deliberately broken flowcharts. Students identify what's wrong:
Discuss why each matters - unclear flowcharts lead to buggy code.
Resources:
Deliberately incorrect flowcharts for error-spotting
Teacher Notes:
This connects to 'identify common errors' in the spec. Emphasise: finding these errors in planning saves hours of debugging later.
Quick challenge: Draw a flowchart for 'Check if a password is at least 8 characters long'. 3 minutes individual work, then swap with partner. Partner traces through with test data: 'hello' (should output 'too short'), 'password123' (should output 'valid'). Did the flowchart work correctly?
Teacher Notes:
This tests both creation and testing of flowcharts. Partners should constructively critique each other's work.
Flowcharts are used in hospitals for emergency procedures (should we give this drug?), in manufacturing for quality control, and in customer service for troubleshooting scripts. The visual clarity of a well-designed flowchart can literally save lives when decisions need to be made quickly.
Connection: Shows that flowcharts are a universal problem-solving tool, not just a computing exercise.
Further Reading:
Flowcharts were invented in the 1920s for industrial engineering. They became central to computing in the 1940s-1960s when memory was so limited that programmers had to plan everything on paper first. The IBM Flow Template (a plastic stencil for drawing flowcharts) was once as essential as a laptop is today.
Connection: Gives historical context and shows why this 'old' technique is still taught and used.
Support:
Stretch:
Reference for correct symbol usage
Prerequisites: 2
What if you could write code that works in ANY programming language? That's basically what pseudocode is.
Show the Rosetta Stone image. Explain: It let people translate between Egyptian hieroglyphics and Greek. Pseudocode is like that for programming - it's a common language that can be 'translated' into any programming language. Show the same algorithm in pseudocode, Python, and JavaScript - the logic is identical, only the syntax changes.
Resources:
The actual archaeological artifact
Side-by-side comparison showing similarity
Teacher Notes:
The visual of identical logic in different languages really hits home. Students see that learning to think algorithmically transfers across languages.
Introduce the OCR reference language with examples:
Variables and I/O:
name = input("Enter your name")
print("Hello " + name)
Selection:
if age >= 18 then
print("Adult")
else
print("Minor")
endif
Iteration:
for i = 1 to 5
print(i)
next i
while count < 10
count = count + 1
endwhile
Emphasise: Indentation matters for readability!
Resources:
One-page syntax reference
Teacher Notes:
The OCR reference language is very readable - show students it's almost like English with structure. Make sure they understand the difference between FOR (known iterations) and WHILE (unknown iterations).
Introduce nesting - putting loops inside loops, or if-statements inside loops. Show example: printing a times table (outer loop for rows, inner loop for columns). Trace through together showing how the indentation helps us track which 'level' we're at. Common exam scenario: understanding what nested loops produce.
Resources:
Commented code showing nesting levels
Teacher Notes:
Nesting is where many students get lost. Use strong visual indentation and physically trace through with line numbers. 'We're in the outer loop, i=1. Now we enter the inner loop, j starts at 1...'
Students receive flowcharts from last lesson (or new ones provided) and must convert them to pseudocode. Start with a simple sequence, then one with a decision, then one with a loop. Compare translations - there may be valid variations.
Resources:
Three flowcharts of increasing complexity
Template showing flowchart on left, space for pseudocode on right
Teacher Notes:
Pairs work well here - they can discuss whether a WHILE or DO UNTIL is more appropriate. Both may be valid depending on interpretation.
Write pseudocode for: 'A program that asks for 5 test scores, calculates the average, and outputs whether the student passed (average >= 50) or failed.'
This requires:
Work individually, then compare solutions.
Teacher Notes:
This is a realistic exam-style question. Watch for: Is the loop correct? Is total initialised before the loop? Is the average calculated AFTER all inputs? Is the selection logic correct?
Give pseudocode for a simple algorithm. Students must:
This tests understanding in multiple representations.
Teacher Notes:
This multi-representation check is powerful. If a student can translate between formats and explain purpose, they truly understand the algorithm.
Professional developers often sketch algorithms in pseudocode during interviews at companies like Google and Amazon. It lets them focus on the logic without worrying about syntax. A good algorithm written in pseudocode can be implemented in Python, Java, JavaScript, or any other language.
Connection: Shows that pseudocode is a professional skill used in high-stakes technical interviews.
Further Reading:
Many features you use daily started as pseudocode on a whiteboard. The Shazam algorithm (identifying songs from a snippet) was designed in pseudocode before any code was written. Getting the logic right first meant the actual coding was much easier.
Connection: Demonstrates that pseudocode is a genuine planning tool, not just an exam format.
Support:
Stretch:
Official OCR pseudocode documentation
YouTube playlist covering OCR pseudocode
Prerequisites: 3
The first computer bug was an actual bug - a moth stuck in a relay. Today, you'll become a bug hunter.
Show the famous photo of the moth taped into Grace Hopper's logbook from 1947 - labelled 'first actual case of bug being found'. Explain: Debugging has been part of computing since the very beginning. Today, students become detectives who solve code crimes using evidence (trace tables) and deduction.
Resources:
The actual logbook page with moth taped in
Teacher Notes:
This is a great bit of computing history. Mention Grace Hopper was a pioneer of programming - possibly link to Ada Lovelace for another female computing hero.
Introduce trace tables: a systematic way to track variable values as an algorithm executes.
Example algorithm:
count = 0
total = 0
for i = 1 to 3
num = input()
total = total + num
count = count + 1
next i
average = total / count
print(average)
Draw trace table with columns: i, num, total, count, output. Work through with inputs 4, 6, 5. Show how each row represents one 'moment' in time.
Resources:
Blank grid for creating trace tables
Teacher Notes:
Key insight: each row is a 'snapshot' of the program state. When a variable changes, that's a new row (or we update that cell). Different teachers have different conventions - be consistent.
Two types of errors that haunt programmers:
Syntax errors: Breaking the grammar rules of the language. The program won't run at all.
Logic errors: The program runs but does the wrong thing.
Show examples of each. Which is easier to find? (Syntax - the computer tells you!)
Resources:
Side-by-side syntax vs logic error examples
Teacher Notes:
Students often think 'it runs so it must be right'. Emphasise that logic errors are sneakier and more dangerous - the program does exactly what you told it, just not what you meant.
Students complete trace tables for two algorithms:
Provide input values. Students compare answers - any differences? Who's right?
Resources:
Two algorithms with specific input values
Teacher Notes:
Common mistake: students miss updating a variable or add a row when nothing changed. Watch for this and address it.
Present 4-5 code snippets, each with ONE error. Students identify:
Examples:
Resources:
Code snippets with deliberate errors
Teacher Notes:
Pairs work well here. Encourage them to explain WHY it's syntax or logic. The deeper understanding matters more than just spotting the error.
Show a complete algorithm that doesn't work correctly. Students must:
This combines all skills from the lesson into one problem.
Teacher Notes:
This is exam-level synthesis. The trace table is the tool that reveals the logic error. Save good examples to use as revision material.
In 1999, NASA's Mars Climate Orbiter crashed because one team used metric units and another used imperial - a logic error that wasn't caught. In 2012, Knight Capital lost $440 million in 45 minutes due to a software bug. Debugging isn't just an academic exercise - it has real consequences.
Connection: Shows that debugging skills are crucial in professional contexts with high stakes.
Further Reading:
Real developers use sophisticated debuggers that let them pause programs, inspect variables (like a trace table, but automatic), and step through code line by line. The Python debugger (pdb) and browser dev tools work exactly like the trace tables students learn, just automated.
Connection: Links trace tables to real debugging tools students may use in programming.
Support:
Stretch:
https://pythontutor.com/ - traces through code visually
Short video about the first computer bug
Prerequisites: 4
If I asked you to find 'Python' in a dictionary, would you start at page 1 and read every word? Of course not. But HOW do you search faster?
Pose the question: How do you find 'Python' in a dictionary? Ask students to describe their actual strategy. They'll say something like 'open to the middle, it's after M, so go to the second half...' - they're already doing binary search! But what if the dictionary wasn't alphabetical? (That's linear search.) Set up the lesson: Today we formalise what they already intuitively understand.
Resources:
Or large reference book for demonstration
Teacher Notes:
This leverages existing intuition. Students realise they already know efficient searching - we're just giving it formal names and structure.
Explain linear search: Check each item in order until you find what you're looking for.
Example: Find 27 in [4, 17, 8, 27, 11, 6]
Pseudocode:
for i = 0 to length(list) - 1
if list[i] == target then
return i
endif
next i
return -1 // not found
Ask: What's the worst case? (Item at the end, or not there at all)
Resources:
Visual showing each comparison
Teacher Notes:
Emphasise: Linear search works on ANY list, sorted or not. It's simple but can be slow for large lists.
Explain binary search: Repeatedly divide the search space in half.
Example: Find 27 in [4, 6, 8, 11, 17, 23, 27, 31]
Only 3 comparisons instead of 7!
CRITICAL: List MUST be sorted. Why? (If not sorted, we can't know which half to keep.)
Resources:
Visual showing the halving process
Teacher Notes:
The prerequisite of sorted data is an exam favourite. Make sure students understand WHY unsorted data breaks binary search.
Line up 8-10 students holding number cards (sorted). One student is the 'searcher'. They must find a target number using only binary search rules:
Run several times. Count comparisons. Compare to if they'd checked one by one.
Resources:
Large cards with numbers, sorted for the activity
Teacher Notes:
This kinaesthetic activity makes the algorithm memorable. The physical halving is powerful. For a class of 30, you can have multiple 'search lines'.
Create comparison table:
| Feature | Linear Search | Binary Search |
|---|---|---|
| Data must be sorted? | No | Yes |
| Best case | 1 comparison | 1 comparison |
| Worst case | n comparisons | log₂n comparisons |
| When to use | Unsorted or small lists | Large, sorted lists |
For 1 million items: Linear might need 1,000,000 checks. Binary needs max 20.
Resources:
Blank table for students to complete
Teacher Notes:
The 20 vs 1,000,000 comparison for a million items is mind-blowing. Even 1,000 items: linear needs up to 1,000, binary needs max 10.
Scenarios to consider:
Exit ticket: Trace through binary search for finding 35 in [5, 12, 17, 25, 35, 42, 58, 67]
Teacher Notes:
The sock example adds humour while making a serious point. The trace is exam practice - make sure they show all comparisons and eliminations.
Google doesn't use simple linear or binary search on every query - they use incredibly sophisticated algorithms built on these fundamentals. But the core principle (don't check everything when you can eliminate half) scales up to planet-sized data. Every search engine, database, and 'find' function uses variations of what students learn today.
Connection: Shows that these 'simple' algorithms are the building blocks of technology students use daily.
Further Reading:
Classic computer science question: How many comparisons would it take to find ANY name in a phone book with 1 million names using binary search? Answer: At most 20! (Because 2^20 > 1,000,000). This demonstrates the power of logarithmic vs linear time.
Connection: Illustrates why algorithm choice matters dramatically at scale.
Support:
Stretch:
https://visualgo.net/en/bst - interactive visualisation
YouTube - Harvard's excellent explanation
Prerequisites: 5
Sorting a deck of cards seems easy. But how would you explain your method to a computer that can only compare two cards at a time?
Give each table group 10 shuffled playing cards. Challenge: Sort them from lowest to highest using a METHOD you could explain to someone who can only do one thing - compare two adjacent cards and swap if needed. Let them try. They'll probably naturally do something like bubble or insertion sort. Ask: 'What was your strategy?'
Resources:
One deck per 3-4 students
Teacher Notes:
Don't name the algorithms yet. Let students discover that there are only so many ways to sort when you're constrained to local comparisons.
Explain bubble sort: Larger values 'bubble up' to the end through repeated adjacent swaps.
Example: Sort [5, 2, 8, 1, 9]
Pass 1:
After pass 1: 9 is in correct position. Repeat for remaining items.
Key insight: After each pass, one more item is in its final position.
Resources:
Step-by-step visual
Teacher Notes:
The 'bubbling' metaphor helps - big numbers float to the top. Show how after each pass, you can ignore one more position at the end.
Explain insertion sort: Build a sorted section one item at a time, inserting each new item in its correct position.
Example: Sort [5, 2, 8, 1, 9]
Key insight: The left portion is always sorted.
Resources:
Visual showing the growing sorted section
Teacher Notes:
This is how most people naturally sort cards in their hand. The 'sorted left side, unsorted right side' visual helps.
Get 6-8 volunteers holding number cards in a shuffled line. Rest of class calls out instructions:
For bubble sort: 'Compare positions 1 and 2. Swap? Now 2 and 3...'
For insertion sort: 'First person, stand still. Second person, where do you go? Third person...'
Compare how many swaps/comparisons each needed.
Resources:
Visible from back of room
Teacher Notes:
The physical movement makes the algorithm tangible. Have someone keep a tally of swaps/comparisons to compare efficiency.
Create comparison table:
| Feature | Bubble Sort | Insertion Sort |
|---|---|---|
| Basic idea | Swap adjacent | Insert in correct position |
| Best for | Simple to understand | Already nearly sorted data |
| Efficiency | Generally slower | Generally faster |
Both are 'simple' sorts used for teaching. Neither is used for large-scale real applications (that's merge sort, coming next lesson!).
Teacher Notes:
Students should understand these aren't 'bad' algorithms - they're just not optimal for large data. They're still useful for small lists or learning.
Show pseudocode/Exam Reference Language for bubble and insertion sort. Without telling them which is which, ask students to identify which algorithm matches each code. Then trace through one with a specific list.
Exit ticket: Given list [7, 3, 9, 5], show the first 2 passes of bubble sort.
Teacher Notes:
Algorithm identification from code is a key exam skill. The trace work is also common on exams.
Amazon sorts millions of products to show you relevant results. Spotify sorts your playlist. Every database query relies on sorted indexes. In 2006, it was estimated that sorting algorithms consume about 25% of all computer processing time worldwide. Efficient sorting isn't just academic - it saves real energy and money.
Connection: Shows sorting is fundamental to modern technology, not just an exam topic.
Further Reading:
There are beautiful videos showing different sorting algorithms as visual patterns or sounds. Watching 15+ algorithms race on the same data reveals just how different 'sorted' and 'sorting' can be.
Connection: Helps students see algorithms as dynamic processes, not just static descriptions.
Support:
Stretch:
YouTube - great visual comparison
Prerequisites: 6
What if the secret to sorting a million items quickly was... to barely sort anything at all?
Tell students: 'I'm going to teach you a sorting algorithm where you never compare more than two items at a time, and yet it's much faster than bubble sort for large lists. The secret? We're lazy in a clever way.' Set up the mystery: how can doing LESS lead to BETTER results?
Teacher Notes:
Create genuine intrigue. Merge sort is elegant but needs the right framing to land as impressive rather than complicated.
Start with: [8, 3, 5, 1, 9, 2, 7, 4]
Step 1: Split into two halves. [8, 3, 5, 1] and [9, 2, 7, 4]
Step 2: Keep splitting until you have single items. [8] [3] [5] [1] [9] [2] [7] [4]
A single item is... already sorted! This is our base case. Now what?
Resources:
Tree showing the splitting process
Teacher Notes:
Draw the tree structure clearly. Each split halves the problem. Students see we're not 'sorting' yet - just breaking apart.
Now we merge sorted lists together:
Merge [8] with [3]: Compare, 3<8, so [3, 8] Merge [5] with [1]: Compare, 1<5, so [1, 5]
Merge [3, 8] with [1, 5]:
The magic: merging two SORTED lists is easy and fast!
Resources:
Visual showing the merging process
Teacher Notes:
The key insight is that merging sorted lists only needs one pass through each. Walk through carefully - this is the conceptual core.
Students trace merge sort on: [6, 2, 8, 4, 3, 7, 1, 5]
Work in pairs. Compare trees - should all look the same for the divide stage.
Resources:
Blank tree structure to fill in
Teacher Notes:
Circulate and check the merge stages especially. Common error: trying to merge unsorted lists or skipping the 'back up the tree' phase.
Compare to bubble sort:
Bubble sort on 8 items: Could need 8×7÷2 = 28 comparisons (worst case) Merge sort on 8 items: 3 levels of splitting, about 8 comparisons per level = ~24 comparisons
But for 1000 items: Bubble sort: Up to 500,000 comparisons Merge sort: About 10,000 comparisons
Merge sort scales much better because it divides the problem!
Teacher Notes:
Don't get too mathematical, but the rough comparison makes the efficiency gains tangible. 'Bubble sort slows down quadratically, merge sort slows down much more gently.'
Show the intermediate stages of three different sorts (bubble, insertion, merge) on the same starting data. Students must identify which is which by looking at the 'state' after a few operations.
Exit ticket: What is the main advantage of merge sort over bubble and insertion sort? (Efficiency on large data sets / divide and conquer approach)
Teacher Notes:
This identification skill is explicitly in the specification. Understanding the characteristic patterns of each sort is key.
Merge sort (and its cousins) are used in Python's built-in sort function, Java's Arrays.sort for objects, and many database systems. When you sort your emails by date, filter products by price on Amazon, or rank search results, merge sort principles are often at work behind the scenes.
Connection: Shows merge sort is a real, production algorithm, unlike bubble sort which is mainly pedagogical.
Further Reading:
One advantage of merge sort is it can be parallelised - split the work across multiple processors. This is how companies sort petabytes of data: divide the problem, let 1000 computers each sort a piece, then merge the results.
Connection: Links to how understanding algorithms helps understand modern distributed computing.
Support:
Stretch:
https://visualgo.net/en/sorting - select merge sort
YouTube - Harvard's visual explanation
Prerequisites: 7
If algorithms were Pokémon, which would you choose for which battle?
Present 'trading cards' for each algorithm with 'stats' like: Speed (best/worst case), Memory use, Difficulty to code, Works on unsorted data? etc. Which algorithms are strong in which situations? Like choosing the right tool for a job.
Resources:
Designed cards with algorithm stats
Teacher Notes:
This gamified approach makes comparison fun and memorable. Students can debate which 'card' they'd play in different scenarios.
Build a comprehensive comparison table together:
| Algorithm | Type | Best For | Requires Sorted? | Efficiency |
|---|---|---|---|---|
| Linear Search | Search | Small/unsorted data | No | Simple |
| Binary Search | Search | Large sorted data | YES | Logarithmic |
| Bubble Sort | Sort | Learning/small data | N/A | Slow |
| Insertion Sort | Sort | Nearly sorted data | N/A | Moderate |
| Merge Sort | Sort | Large data sets | N/A | Fast |
Discuss: When would you choose each?
Resources:
For students to fill in during discussion
Teacher Notes:
This consolidates learning across multiple lessons. Emphasise that there's no 'best' algorithm - it depends on context.
Show code snippets (in pseudocode or Python/OCR reference language) for each algorithm learned. Students must identify:
Cover: Linear search, binary search, bubble sort, insertion sort, merge sort (showing either divide or merge phase).
Resources:
Code snippets with questions
Teacher Notes:
This directly practices the specification requirement to identify algorithms from code. Look for students who can articulate the 'giveaway' features.
Groups receive scenario cards and must recommend which algorithm to use and justify:
Defend choices - there may be valid alternatives!
Resources:
Laminated situation descriptions
Teacher Notes:
Encourage debate. Some scenarios have multiple valid answers with different trade-offs. The reasoning matters more than the 'correct' answer.
Timed exam-style questions:
Mark together and discuss approach.
Resources:
OCR-style algorithm questions
Teacher Notes:
These are realistic exam questions. Discuss mark schemes and what full-mark answers look like.
Students vote on 'awards' for algorithms:
Reflect: What's the most important thing you've learned about algorithms in this unit?
Teacher Notes:
End on a fun note while reinforcing key takeaways. The reflection question helps solidify learning.
Companies like Google, Spotify, and game studios employ 'algorithm engineers' who design and optimise algorithms for specific problems. These roles combine the theoretical knowledge from lessons like these with creative problem-solving. Understanding algorithm trade-offs is the foundation of this career path.
Connection: Shows that algorithm knowledge translates directly to high-value tech careers.
Further Reading:
New algorithms are still being invented. In 2022, DeepMind used AI to discover faster matrix multiplication algorithms - something mathematicians had worked on for decades. The algorithms students learn are classics, but the field keeps evolving.
Connection: Shows computer science as a living, advancing field.
Further Reading:
Support:
Stretch:
Visual one-page reference
Official exam practice
Visualgo, Algorithm-visualizer.org
Information about algorithm-focused careers
Prerequisites: 8