Simple implementation of Huffman encoding algorithm.