Data compression — AQA GCSE Computer Science
Verified courseTeaching note checked against the official specification.
Data compression reduces file size by encoding information using fewer bits than the original representation, categorized into lossy and lossless techniques. In AQA GCSE Computer Science, understanding algorithms like Run Length Encoding and Huffman coding is vital for evaluating bandwidth usage, transmission speed, and storage efficiency.
Data compression explained
Data compression is the process of reducing the number of bits needed to store or transmit a file, so the same information takes up less space.
Read the full explanation
A compression method looks for redundancy — repeated or predictable patterns — and records it more economically. For example, a bitmap with large areas of identical colour can be stored by recording the colour once with a count of how many pixels share it, rather than storing every pixel separately. The compressed version must still allow the original data to be recovered, either exactly (lossless) or approximately (lossy). In an MCQ, identify the option that describes reducing file size by encoding data more efficiently, and reject options that merely describe deleting data, increasing resolution or changing file format without reducing the bits stored.
Your focus
- State that data compression reduces the number of bits needed to store or transmit data.
- Identify that compression exploits redundancy such as repeated patterns.
- Select the option that correctly describes compression rather than deletion or format change.
Which command word is this?
Set out the causes, reasons, or mechanisms clearly. Link your points using connectives like 'because', 'therefore', or 'meaning that', especially when discussing data loss or transmission speeds.
Data compression exam tips
Topic Overview
Data compression is the process of reducing the physical size of a data file by re-encoding its contents using fewer bits than the original representation. In AQA GCSE Computer Science, compression is divided into two fundamental methodologies: lossy compression, which permanently deletes redundant data, and lossless compression, which reduces file size without losing any original information.
Understanding compression is vital because modern computing relies heavily on transferring and storing vast volumes of digital media over bandwidth-constrained networks. By mastering algorithms like Run Length Encoding (RLE) and Huffman coding, students learn how mathematical representations optimize secondary storage limits, reduce web transmission latency, and maintain software integrity.
Key Concepts
- →Lossy compression permanently discards imperceptible or redundant data to achieve significant file size reduction, ideal for audio (MP3), images (JPEG), and streaming video (MP4).
- →Lossless compression reconstructs the original file byte-for-byte with zero quality loss, essential for program executables, text files, and source code (ZIP, PNG, FLAC).
- →Run Length Encoding (RLE) compresses data by replacing consecutive repeated data values with a single frequency count and value pair.
- →Huffman coding builds a binary tree based on character frequencies to assign shorter bit patterns to frequently occurring characters and longer patterns to rarer ones.
- →Network advantages of compression include reduced transmission times, less bandwidth consumption, and lower network congestion.
Marking Points
- Compression reduces the number of bits required to store or transmit data, so file size falls.
- Compression works by identifying and encoding redundancy such as repeated patterns or predictable values.
- The compressed data can be decompressed to recover the original information, exactly or approximately.
- Compression is not the same as deleting data or discarding information the user still needs.
- A correct MCQ choice describes encoding data more efficiently so fewer bits represent the same content.
Examiner Tips
- 💡Read every option and ask which one describes reducing the bits needed to represent the data.
- 💡Eliminate options that describe deleting data or increasing file size.
- 💡Link your chosen answer to the idea of redundancy being encoded more efficiently.
- 💡When explaining the advantages of compression in exam questions, always mention both the reduction in secondary storage space and the reduction in network transmission time.
- 💡In Huffman coding calculation questions, write down your character frequency counts clearly before multiplying by the bit lengths to ensure you pick up method marks even if an arithmetic error occurs.
- 💡Read the question carefully regarding ASCII bit lengths; AQA questions frequently specify either 7-bit or 8-bit ASCII, which directly impacts your uncompressed size calculations.
Common Mistakes
- Thinking compression means deleting parts of a file permanently; correction: compression re-encodes the same information using fewer bits, and lossless methods recover it exactly.
- Confusing compression with changing file format; correction: converting a file type does not necessarily reduce the bits stored, whereas compression specifically reduces the number of bits.
- Assuming compression always loses quality; correction: lossless compression preserves the original data exactly, while only lossy compression discards some detail.
- Thinking lossy compression is always superior because it achieves smaller file sizes; lossy permanently destroys data, making it unsuitable when exact precision is required.
- Confusing data compression with data encryption; compression aims to make files smaller for storage/transmission, whereas encryption aims to make data unreadable without a decryption key.
- Assuming every file can be compressed indefinitely; files with high entropy (randomness) or files that are already compressed may actually increase in size if re-compressed with lossless methods.
Revision Plan
- 1Day 1: Learn the definitions, trade-offs, and file extensions associated with lossy and lossless compression.
- 2Day 2: Practice Run Length Encoding (RLE) by encoding and decoding text strings and monochrome 2D pixel grids.
- 3Day 3: Learn how to interpret and traverse Huffman trees to derive variable-length binary prefix codes.
- 4Day 4: Work through exam-style calculation questions comparing uncompressed ASCII bit counts with compressed Huffman representations.
- 5Day 5: Complete timed past paper exam questions focused on scenario-based recommendations (e.g. streaming vs document archival).
Exam Question Types
- 📋Scenario-based justification: Choosing lossy or lossless compression for a specific user scenario (e.g. medical imaging vs music streaming) and explaining why.
- 📋Huffman tree decoding and encoding: Traversing a provided tree from root to leaf to decipher binary strings or generate codes for given letters.
- 📋Size comparison calculations: Calculating the exact number of bits or bytes saved by applying RLE or Huffman coding compared to standard representations.
- 📋Definition and trade-off short answers: Defining lossy and lossless compression and outlining the impact on download speeds and visual/auditory quality.
Command Word Expectations (AQA)
Set out the causes, reasons, or mechanisms clearly. Link your points using connectives like 'because', 'therefore', or 'meaning that', especially when discussing data loss or transmission speeds.
Arrive at a numerical answer showing all working out. Always include intermediate multiplication steps and state the correct units (bits or bytes).
Provide a concise, factual answer without detailed explanation, such as identifying a suitable compression type or naming a file format.
How Students Lose Marks (Examiner Pitfalls)
Step-by-Step Worked Solutions
Question: A monochrome bitmap image contains a row with the following sequence of pixels: 8 White, 14 Black, 3 Black, and 12 White. Explain how Run Length Encoding (RLE) compresses this sequence and calculate the number of bytes required to store this row if each run is represented by a 1-byte counter followed by a 1-byte colour value (where 0 is Black and 255 is White).
- 1.Step 1: Simplify consecutive runs of identical colour. The sequence has 14 Black followed immediately by 3 Black, which combines into a single continuous run of 17 Black pixels.
- 2.Step 2: Identify the distinct runs in order: Run 1 = 8 White; Run 2 = 17 Black; Run 3 = 12 White. This results in exactly 3 colour runs.
- 3.Step 3: Calculate the storage requirement per run. Each run requires 1 byte for frequency and 1 byte for pixel value: 2 bytes per run.
- 4.Step 4: Compute the total bytes: 3 runs multiplied by 2 bytes per run = 6 bytes.
Question: The word 'LEVEL' is encoded using standard 8-bit ASCII. A Huffman tree produces the following variable-length codes: L = '0', E = '10', V = '11'. Calculate the number of bits saved by using this Huffman coding scheme compared to 8-bit ASCII.
- 1.Step 1: Calculate original uncompressed size using 8-bit ASCII. 'LEVEL' has 5 characters: 5 characters * 8 bits = 40 bits.
- 2.Step 2: Determine character frequencies in 'LEVEL': L appears 2 times, E appears 2 times, V appears 1 time.
- 3.Step 3: Calculate the compressed bit length for each character type using the given codes: L (1 bit) * 2 = 2 bits; E (2 bits) * 2 = 4 bits; V (2 bits) * 1 = 2 bits.
- 4.Step 4: Sum the compressed bits: 2 + 4 + 2 = 8 bits.
- 5.Step 5: Calculate total bits saved: 40 bits (original) - 8 bits (compressed) = 32 bits.