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?
Explain how run-length encoding (RLE) works to compress data.