CSE 2320: Algorithms and
Huffman exhibits the greedy choice property.
Assume x and y have lowest frequencies.
If x and y have lowest frequencies, then there exists an optimal code in which x and y are at the maximum depth (greedy choice).
Greedy choice would put them where
are in T.
f(y) and f(b)
f(c). We know f(x)
f(b) and f(y)
B(T) - B(T') =
Thus, moving x to the bottom (similarly, y to the bottom) yields a better (optimal) solution.
Copyright © 1998 The University of Texas at Arlington