Huffman Code
Huffman Code
The Iollowing example bases on a data source using a set oI Iive diIIerent symbols. The symbol's
Irequencies are:
Symbol Frequency
A 24
B 12
C 10
D 8
E 8
---- total 186 bit
(with 3 bit per code word)
The two rarest symbols 'E' and 'D' are connected Iirst, Iollowed by 'C' and 'D'. The new parent
nodes have the Irequency 16 and 22 respectively and are brought together in the next step. The
resulting node and the remaining symbol 'A' are subordinated to the root node that is created in a
Iinal step.
Code Tree according to Huffman
Symbol Frequency Code Code total
Length Length
A 24 0 1 24
B 12 100 3 36
C 10 101 3 30
D 8 110 3 24
E 8 111 3 24
---------------------------------------
ges. 186 bit tot. 138 bit
(3 bit code)