The LZ77 compression algorithm

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

The LZ77 compression algorithm

OmegaKV
I remember a very long time ago when I was first getting into software I was curious about how compression works. I started looking through some Wikipedia articles on compression and was blown away by the complexity, and concluded that you need to be a genius to even begin to understand how compression works.

But if you look past some of the legitimately complicated optimizations, and intimidating foreign names (e.g. "Lempel-Ziv"), some of the principles of compression are surprisingly simple and easy to understand.

Take for example the LZ77 algorithm:

https://archive.ph/20130107232302/http://oldwww.rasip.fer.hr/research/compress/algorithms/fund/lz/lz77.html

This intuitive and simple 4-step algorithm is together with Huffman coding (the steps of which are also easy to learn) the foundation of the ubiquitous zip compression format.

I think it would be a good exercise for anyone learning programming to write a program that compresses and decompresses files using the LZ77 method.
Reply | Threaded
Open this post in threaded view
|

Re: The LZ77 compression algorithm

OmegaKV
For step 5 I believe "A B C" should be the match, not just "A B". I believe this is a mistake on the part of the website. Someone can correct me if I am wrong.