.

Huffman Tree Algorithm Example

Huffman Code - Example:

The following example basics using a data source utilizing some 5 different symbols. The symbol's frequencies tend to be:

SymbolFrequency
A24
B12
C10
D8
E8
F186 (total bit) (with 3 bit per code word)

The two rarest symbols “E” and “D” tend to be linked first, then “C” and “D”. The new parent nodes have the frequency 16 and 22 respectively and therefore are brought together within the next step. The resulting node and also the remaining symbol “A” are subordinated towards the root node that is created in a final step.

Code Tree according to Huffman

Code Tree according to Huffman
SymbolFrequencyCodeCode LengthTotal Length
A240124
B12100336
C10101330
D8110324
E8111324
186 bit (3 bit code)138 bit
.