in Algorithms retagged by
633 views
1 vote
1 vote
consider the following message BCCABBDDAECCBBAEDDCC find the no of bits requiered for huffman encoding of above message
in Algorithms retagged by
by
633 views

1 Answer

2 votes
2 votes

Message : BCCABBDDAECCBBAEDDCC

The frequency of Alphabets in the message is :

A = 3, B = 5, C = 6, D = 4, E =2

 

The Huffman Tree will look like : 

 

             

 

So, the Huffman code assigned to each Alphabets are :

A – 011, |A| = 3

B – 10, |B| = 2

C – 11, |C| = 2

D – 00, |D| = 2

E – 010, |E| = 3

 

Total Number of Bits : 3 x 3 + 5 x 2 + 6 x 2 + 4 x 2 + 2 x 3 = 9 + 10 + 12 + 8 + 6 = 45.

 

 

edited by

2 Comments

For E, it will be 010.
0
0

@mili_dhara Thanks! I have Done the necessary corrections..

0
0