This is the highest-value skill in 3.3.8, and it has three parts the specification names explicitly.
1. Bits required using Huffman coding
Huffman total=∑(frequency×code length)
Method: build a table with one row per character.
Encode the word BANANA using the tree above (A=0, B=10, C=110, D=111).
| Character | Frequency | Code | Length | Freq × Length |
|---|
| A | 3 | 0 | 1 | 3 × 1 = 3 |
| B | 1 | 10 | 2 | 1 × 2 = 2 |
| N | 2 | 110 | 3 | 2 × 3 = 6 |
| Total | 6 | | | 11 bits |
(Treating N as having the code 110 for this illustration.)
2. Bits required uncompressed in ASCII
ASCII total=number of characters×7
ASCII is 7-bit (3.3.5), so each character takes exactly 7 bits regardless of how often it appears.
BANANA has 6 characters, so:
6×7=42 bits
⚠️ Use 7, not 8. The specification names 7-bit ASCII. Using 8 is the single most common error in this calculation. If a question explicitly says each character is stored in a byte, then use 8 — but otherwise 7 is correct.
3. Bits saved
bits saved=uncompressed−compressed
42−11=31 bits saved
You may also be asked for the saving as a percentage:
4231×100≈74%
The full method, every time
- Read every code off the tree and write them in a table.
- Count the frequency of each character in the data.
- Multiply frequency × code length for each, and total → compressed bits.
- Count all the characters and multiply by 7 → uncompressed bits.
- Subtract → bits saved.
AQA tip. Show the table. Mark schemes award marks for the frequencies, the code lengths and the products separately, so a slip in the final addition still leaves most of the marks intact.