Huffman coding – AQA GCSE Computer Science lesson (8525)
Pupils learn to explain how Huffman coding compresses data and read characters' codes from a Huffman tree.
Lesson 3 of 11 in unit 10.5 Compression, Networks and Searching, taught in Year 10, Summer 1. It answers one big question: How can common letters take up fewer bits?
By the end, pupils can explain how Huffman coding compresses data and read characters' codes from a Huffman tree.
- The Build (the main task)
- Explain how Huffman coding reduces the number of bits needed to store a piece of text. (2 marks) Using the Huffman tree, state the Huffman codes for the characters E, R and D. (3 marks) The bit pattern 110000110 was made with the same tree. State the text it represents. (2 marks)
- Support version
- The Huffman tree with the 0 and 1 labels written on every branch, a code table to fill and the bit pattern split up.
- Challenge
- Using the Build's Huffman tree, write the bit pattern for the word READER. (2 marks) Complete the part-drawn Huffman tree so it matches this code table: M 0, A 10, P 110, S 111. Write the characters in the boxes and a 0 or 1 on every branch. (3 marks) A student suggests these codes for a catalogue: space 1, E 10, T 0. Explain why these codes would not work, and how a Huffman tree stops this problem. (4 marks)
- Real-world link
- The library's catalogue text sent to the branches in fewer bits.
- Key words
- Huffman coding, Huffman tree and Frequency, each with a definition, an icon and a common mix-up on the key vocabulary slide.
- Misconceptions it tackles
- “In Huffman coding every character gets a code of the same length”; “A Huffman code is read from the character up to the top of the tree”.
- AQA 8525 specification
- 3.3.8 (data compression: why compress; Huffman coding and trees; bits in Huffman and ASCII; run length encoding).
Every lesson follows the same Code & Commerce structure: a Bell Task recall starter, key vocabulary with definitions and icons, short teaching chunks with a check before pupils move on, The Build (one main task), challenge questions that get harder, and an exit question. Answers reveal one at a time on the slides, and everything is editable PowerPoint and Word.
Pupils can do it all on paper.
Also sold in the Compression, Networks and Searching unit bundle, which includes the medium term plan, and in the full-year and complete-course bundles.
An independent resource written for AQA GCSE Computer Science (8525). It is not endorsed by AQA.
What's included
- Slide deck (PowerPoint)
- Lesson plan (Word)
- Worksheet (Word)
- Support worksheet with scaffolds (Word)
- Single-teacher licence: use and adapt it with your own classes
More for GCSE Computer Science (AQA)
See allPupils learn to explain what data compression is and why it is used, and represent data as run length encoding frequency/data pairs.
Pupils learn to complete trace tables for algorithms in AQA pseudo-code, flowcharts and the class's language, and state an algorithm's purpose.
Pupils learn to calculate the bits needed for text in Huffman coding and in 7-bit ASCII and the bits saved.
Written for the specifications named. Not endorsed by or affiliated with any exam board.