Page 377 - Programming Microcontrollers in C
P. 377
362 Chapter 7 Advanced Topics
E
' ' ' \n '
A R O I N L
T H C M S D
B
K
G J Y U P V
F W Z
X Q
Figure 7-1: Huffman Tree for Encoding the Phone Book Data
We have seen above that the minimum number of bits per character
for the telephone book is 4.39. We cannot expect to reach this level,
but we should expect to be significantly fewer than 8 bits per character.
The code corresponding to the tree in Figure 7-1 is shown in the
following table:
Character Code
‘ ‘ 100
‘\n’ 101
a 0001
b 0000111
c 000010
d 111110
e 01
f 0000110110
g 000011000