Example Huffman Code Problem
Construct a Code tree for: A TEST EXAMINATION ANSWER (25 total characters)
Symbol frequencies used to build a Huffman Code.
A T E S X M I N O W R SPACE
4/25 3/25 3/25 2/25 1/25 1/25 2/25 3/25 1/25 1/25 1/25 3/25
A T E S X M I N O W R SPACE
.16 .12 .12 .08 .04 .04 .08 .12 .04 .04 .04 .12
N SPC A X M O W T E R S I
.12 .12 .16 .04 .04 .04 .04 .12 .12 .04 .08 .08
| | | \ / \ / | | \ / |
| | | .08 .08 | | .12 |
\ / | \ / \ / \ /
.24 \ .16 .24 .20
\ \ / \ /
\ .32 .44
\ / /
.56 /
\
1.00
SPC 001
A 010
E 101
I 111
N 000
T 100
R 1100
S 1101
X 01100
M 01101
O 01110
W 01111
To print: ANSWER 0100001101011111011100 (Uses only 22 bits for
A N S W E R six chars, 3.67 bits/char)