Text Compression

You Can Say That Again! #

Many computer users are familiar with compressed formats such as zip, gzip, or gif images. These are based on a method called Ziv-Lempel coding, which turns out to be an interesting exercise in finding patterns in text.

Children’s rhymes and stories are good examples for text compression, because they often involve repeated words and sequences.

Activity description (PDF) #

Translations and other versions #

Compressing Bananas

An older version of this activity can be downloaded in PDF format here. The content is similar to the current version, but there’s some extra technical information.

More lessons and activities #

If you want to find out more #

Videos #

Additional resources #

Great Principles of Computer Science #

  • Recollection
  • Communication

ACM K12 Curriculum #

  • Level I (Grades 3-–5) Topic 11: develop a simple understanding of an algorithm