0% found this document useful (0 votes)
50 views

Huffman Code

This document describes an example of applying the Huffman coding algorithm to encode 5 symbols with different frequencies. It shows the symbols and their frequencies, then describes how the algorithm connects the least frequent symbols to form parent nodes and progressively combines them until a binary code tree is formed with a root node. The summary provides the encoded symbols and their corresponding code lengths.

Uploaded by

rathivi
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views

Huffman Code

This document describes an example of applying the Huffman coding algorithm to encode 5 symbols with different frequencies. It shows the symbols and their frequencies, then describes how the algorithm connects the least frequent symbols to form parent nodes and progressively combines them until a binary code tree is formed with a root node. The summary provides the encoded symbols and their corresponding code lengths.

Uploaded by

rathivi
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Huffman Code: Example

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)

You might also like