Skip to content

Build Your Own Compression Algorithm

Build a complete data compressor from first principles. You'll compute Shannon entropy, build Huffman trees, implement LZ77 sliding-window matching with hash chains, and combine them into a DEFLATE-style compressor with CRC checksums. By the end you'll deeply understand what gzip, zstd, brotli, and every modern compressor actually do.

intermediate15 lessons4 chapters15 graded exercisesPython

No sign-up needed for lesson 1 · certificate on completion · sign up to save progress

What you’ll have built

Chapter by chapter. Every step is a graded exercise.

  • Entropy & Frequency
  • Huffman Coding
  • Dictionary Coding (LZ77)
  • Putting It Together (DEFLATE)
Starts in Python — solve in the language you choose in the editor, same tests either way.

Curriculum

4 chapters, 15 lessons. Each lesson is a short read, one graded exercise, and a quiz.

  1. 1Frequency CountingRead · exercise · quiz
  2. 2Shannon EntropyRead · exercise · quiz
  3. 3Run-Length Encoding (Warmup)Read · exercise · quiz
Loading reference solution…
Build Your Own Compression Algorithm