What is Huffman coding? Construct a Huffman Tree and determine the code for the following characters and frequencies given.
Character A B C D E
Frequency 20 10 10 30 30
1 Answer
  • Huffman code is an optimal prefix code for lossless data compression.
  • Huffman coding is based on the frequency of occurrence of a data item.
  • The principle is to use a lower number of bits to encode the data that occurs more frequently.
  • Codes are stored in a Code Book which may be constructed for each character or a set of characters. In all cases the code book plus encoded data must be transmitted to enable decoding.
  • Here is the Huffman Tree:-

enter image description here

The codes are:-

Character A B C D E
Code 01 000 001 10 11
Please log in to add an answer.