Exercise 2.71. Suppose we have a Huffman tree for an alphabet of n symbols, and that the relative frequencies of the symbols are 1, 2, 4, ..., $2^{n-1}$ . Sketch the tree for n=5; for n=10. In such a tree (for general n) how may bits are required to encode the most frequent symbol? the least frequent symbol?
我们可以把树画成下面这个样子的。
({A B C D E},31}
/ \
/ \
/ \
A, 2^4 ({B C D E}, 15)
/ \
/ \
/ \
B, 2^3 ({C D E}, 7)
/ \
/ \
/ \
C, 2^2 ({D E}, 3)
/ \
/ \
/ \
D, 2 E, 1
因为
因此,频率最高的,只要 1 bit,最低的,要 n-1 个 bit 位。