update huffman code algorithm