Optimality Principle 2
The second lowest probability is a sibling of the the smallest in some optimal Huffman tree.
If not, we can move it there not raising the cost.
p
q
T
p smallest
q 2nd smallest
q < r
k < h
r
p
r
T’
q
C(T’) = C(T) + hq - hr + kr - kq = C(T) - (h-k)(r-q) < C(T)
h
k
Previous slide
Next slide
Back to first slide
View graphic version