Run length encoding and dictionary coding – OCR A Level Computer Science lesson (H446)
Students learn to apply run length encoding and dictionary coding to data and calculate whether the result is smaller.
Lesson 2 of 12 in unit 12.11 Compression, Encryption, Hashing and Databases, taught in Year 12, Summer 2. It answers one big question: How can repeated patterns make a file smaller?
By the end, students can apply run length encoding and dictionary coding to data and calculate whether the result is smaller.
- The Build (the main task)
- Complete the run length encoding of the Shutterbox logo's pixel rows and the dictionary coding of two photo captions, and calculate the size of each before and after, including the dictionary (6 marks).
- Support version
- A part-completed encoding table for the logo's first row (colour, count) and a dictionary with its first two words entered.
- Challenge
- Explain which of the two methods would compress a photo of a sunset better, and why run length encoding could make a detailed photo larger.
- Real-world link
- Shutterbox's simple two-colour logo and its members' repeated captions ('Harbour at dusk', 'Harbour at dawn').
- Key words
- Run length encoding (RLE), Dictionary coding and Pattern, each with a definition, an icon and a common mix-up on the key vocabulary slide.
- Misconceptions it tackles
- “Run length encoding always makes data smaller”; “The dictionary does not count towards the compressed size”.
- OCR H446 specification
- 1.3.1 (b).
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.
Also sold in the Compression, Encryption, Hashing and Databases unit bundle, which includes the medium term plan, and in the full-year and complete-course bundles.
An independent resource written for OCR A Level Computer Science (H446). It is not endorsed by OCR or Cambridge University Press & Assessment. Programming project (NEA) lessons teach general skills on a made-up example project and give supervised time, within JCQ's rules on the help a centre may give.
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 A Level Computer Science
See allStudents learn to compare lossy and lossless compression and justify which suits a given type of file.
Free sample lessonStudents learn to describe symmetric and asymmetric encryption and state whose key encrypts and decrypts in each.
Students learn to explain how a digital signature is created and checked, and how it authenticates the sender and shows the message is unchanged.
Written for the specifications named. Not endorsed by or affiliated with any exam board.