Huffman tree construction