Huffman tree builder