图1 An impossible Huffman tree, showing the situation where the two nodes with least weight,wi and wj are not the deepest nodes in the tree. Triangles represent subtrees.
. If any other leaf nodes in the tree were deeper, we could reduce their weighted path length by swapping them withw1 or w2. But the lemma tells us that no such deeper nodes exist. Call T′ the Huffman tree that is identical to T except that node V is replaced with a leaf node V′ whose weight is w1+w2. By the induction hypothesis, T′ has minimum external path length. Returning the children to V′ restores tree T, which must also have minimum external path length.