Huffman Coding
Huffman Coding
Presented by
Mr. P. Arul Selvam
AP/CSE/HICET
1
Huffman Coding
3
Educate Ethics Excel
How Huffman Coding works?
Suppose the string below is to be sent over a network.
5
Educate Ethics Excel
How Huffman Coding works?
2. Sort the characters in increasing order of the frequency. These
are stored in a priority queue Q.
6
Educate Ethics Excel
How Huffman Coding works?
7
Educate Ethics Excel
How Huffman Coding works?
8
Educate Ethics Excel
How Huffman Coding works?
8. For each non-leaf node, assign 0 to the left edge and 1 to the
right edge.
For sending the above string over a network, we have to send the
tree as well as the above compressed-code. The total size is given
by the table below.
9
Educate Ethics Excel
How Huffman Coding works?
A 5 11 5*2 = 10
B 1 100 1*3 = 3
C 6 0 6*1 = 6
D 3 101 3*3 = 9
10
Educate Ethics Excel
How Huffman Coding works?
Without encoding, the total size of the string was 120 bits.
After encoding the size is reduced to 32 + 15 + 28 = 75.
11
Educate Ethics Excel
How Huffman Coding works?
Decoding
12
Educate Ethics Excel
Thank
you
21AI4201 / Database Management Systems 13
Educate Ethics Excel