Huffman encoding. Initial implementation.