http://marknelson.us/1989/10/01/lzw-data-compression/
This famous article describes the LZW compression algorithm.