Dictionary-Based Compression (LZW)

Part of Compression ยท Section 5 of 12

Key FactsUnit: 3.3 Data RepresentationGCSE

How Dictionary Compression Works:

Build a dictionary of common patterns/phrases. Replace patterns with short codes.

Simple Example:

  Text: "the cat sat on the mat the rat sat"
  
  Dictionary:
  1 = "the "
  2 = "sat "
  3 = "at "
  
  Compressed: "1cat 2on 1m31r32"
  
  Original: 33 characters
  Compressed: ~17 characters + dictionary
  

Real Applications:

  • ZIP files: Uses LZ77/DEFLATE algorithm
  • GIF images: Uses LZW for color table compression
  • PDF files: Text and object compression
  • Works best: Text files, code, HTML (lots of repeated words/patterns)

This key facts covers Dictionary-Based Compression (LZW) within Compression for GCSE Computer Science. Revise Compression in 3.3 Data Representation for GCSE Computer Science with 16 exam-style questions and 16 flashcards. This topic appears regularly enough that it should still be part of a steady revision cycle. It is section 5 of 12 in this topic. Use this key facts to connect the idea to the wider topic before moving on to questions and flashcards.

Practice questions for Compression

Which statement correctly describes lossy compression?

  • A. The original file can be perfectly restored after decompression.
  • B. Data is permanently removed and the original cannot be exactly recreated.
  • C. The compressed file is always the same size as the original.
  • D. No data is removed during the compression process.
1 markfoundation

Explain how run-length encoding (RLE) works to compress data.

3 marksstandard

Quick recall flashcards

16 questions on Compression: practise free

Instant marking, adaptive difficulty and spaced-repetition flashcards โ€” all aligned to your exam board.

Start revising free โ†’