DemoHut

Compression 101

Strangely enough, for these many years I've learnt programming, never have I tried compressing a file with hand-written code.

Huffman encoding is one of the most classic lossless compression algorithms. Here I'm using it to compress/decompress files as a coding practice.

It turns out to be more difficult than I expected, as there are quite a lot of things to consider about:


What is the probability that the compressed size is exactly the same? I've encountered one in the first few minutes of testing.

Decompressor

All demos have been tested on Microsoft Edge/macOS.