Huffman coding algorithm