Implementation of Huffman coding.