Everyday computer scienceLesson 091 min
How does a zip file shrink without losing anything?
A zip file does not store a repeat twice. The first time, it writes the text. After that, it writes a short note: go back this far and copy this many characters. Unzipping follows the notes, so nothing is lost. A sentence repeated a hundred times, 4,800 bytes, came out at 84. Random data has nothing to point back to, and came out slightly bigger than it went in.
Remember
Compression works by removing repetition, so already compressed files barely shrink.
