Huffman tree de- and encoding