Community resourceWorksheet
OCR H446 1.3.1 Run-length encoding
Part 2 of 7 · H446 1.3.1 · Compression, encryption and hashing
Run-length encoding is examined at H446 1.3.1 as an exact, reversible process, and most lost marks come from the field order convention or from claiming a saving the data does not support. Students encode, decode and round-trip check streams under a stated convention, including the case where the representation grows.
Students will:
- segment a sequence into runs and store each run as a symbol and a count
- explain why two separated runs of the same symbol cannot be merged into one pair
- decode a supplied stream and check the reconstructed length
- use run counts and stored overhead to say when run-length encoding helps and when it expands data
- work to a count-then-symbol key and describe the error made by assuming the other order
Inside: 6 explanation cells, 1 multiple-choice question, 2 fill-in-the-blanks cells and 3 written answers. 26 marks, about 40 to 50 minutes.
Series: H446 1.3.1 · Compression, encryption and hashing, part 2 of 7.
Shared by Coding PathwayVerified teacher
- 12 cells
- About 45 minutes
- CC BY-SA 4.0
- Shared 31 Aug 2026
- Updated 3 Sept 2026
Preview
The whole resource, exactly as a class sees it. Answers and marking are held back.
Run-length encoding
Run-length encoding (RLE) replaces each run of identical adjacent symbols with a pair. This worksheet uses symbol then count as its primary convention because that matches OCR's recent assessed form. The order is always a supplied convention, not a universal law.
Worked model: segment, pair, reconstruct, verify
For MMMMQQRRR, the adjacent runs are MMMM | QQ | RRR. Under symbol-count, the encoded form is M4 Q2 R3. Decoding repeats M four times, Q twice and R three times. The reconstructed length is 9 and the sequence exactly matches the original, so the lossless round trip is valid.
A second representation: one bitmap row
Treat 0000011100 as a row of ten black/white pixel symbols. Its runs are 00000 | 111 | 00, so symbol-count gives 05 13 02.
RLE operates on repeated adjacent symbols, not on “images” as a category. The first and last runs both contain 0, but they must remain separate because a run of 1s lies between them. If rows are encoded separately, a run does not silently continue across a row boundary.
Why can the two 0-runs in 0000011100 not be combined as one 07 pair?
- ARLE permits each symbol only once
- BRLE records adjacent runs, and the 1-run separates them
- CThe final two zeros are lossy
- DCounts may never exceed five
- M4 Q2 R3
- 4M 2Q 3R
- 9
- 3
Using symbol-count pairs, encode KKKLLMMMMMN, decode T2 U4 V1, and show a reconstructed-length check for each.
Separate runs before pairing. For decoding, repeat each symbol by the count that follows it.
Students type their answer here.
Explain why RLE is likely to help AAAAAAAAAABBBBBB but may increase the representation of ABABAB. Use the number of runs and the stored-pair overhead rather than saying one is ‘an image’ or ‘text’.
Count the pairs. Every alternating symbol becomes its own one-symbol run.
Students type their answer here.
Apply the model independently
The remaining tasks change the context or reduce the support. Complete them without copying the worked model, then check that each explanation connects a mechanism to its consequence.
When the representation grows
For ABABAB, symbol-count is A1 B1 A1 B1 A1 B1: six input symbols become six stored pairs. RLE has not lost data, but it has added count fields.
Suppose an exercise states that each original symbol uses 8 bits and each stored count also uses 8 bits. Then the original uses 6 × 8 = 48 bits, while six pairs use 6 × (8 + 8) = 96 bits. This is a calculation from supplied widths, not a compression-ratio formula to memorise.
A device manual defines each pair as count then symbol. Encode PPPPQRRR under that key, then decode 2A1B4C. Explain the error made by someone who assumes symbol-count without reading the key.
Write the convention first. Verify both reconstructed sequences.
Students type their answer here.
Review your understanding
Before submitting, check that you can explain the main distinction in your own words, apply it in an unfamiliar context and justify each consequence rather than only naming a feature.