Compression reduces the space needed to represent information, helping large files move faster and occupy less storage. The transformation must preserve enough information to be useful; in lossless compression, it remains reversible. section 6.0 section 6.1
A shorter coffee order
“Four espressos, two double espressos, a cappuccino, and two lattes” can become “4E2DC2L.” The seven-character message is much shorter than the original, but only because the recipient already knows the decoding instructions. section 6.1
Compression works best when data contains patterns. Frequent words or sequences can receive short codes, while uncommon material remains literal. A word-list scheme replacing the hundred most-used English words with two-character codes reduced a 975-character passage to 880 characters after adjacent codes were joined. section 6.2
Figure 6.1 Our example text, from Metamorphosis by Franz Kafka
Inspect the sample passage alongside the word list and successive compressed forms to see how repeated language becomes shorter codes. section 6.2
Compression involves several important trade-offs:
- Uniform data may offer fewer useful patterns, limiting how much it can shrink. section 6.1
- Some messages cannot be shortened when all possible messages are equally likely; encoding savings in one case can require extra space elsewhere. section 6.1
- Lossless methods preserve all content, while lossy methods discard carefully chosen information for greater size reductions. section 6.7










