In: Computer Science
Q. Given a document with 32 distinct characters, with equal number of occurrences of each, what would be the ratio of the length of the Huffman coded document to the original, if each character in the input was coded in 8 bits? Show your analysis.
Given a document with 32 distinct characters, with equal number of occurrences of each
For example ---->
Plain Text = ABCDEFGHIJKLMNOPQRSTUVWXYZ012345
Huffman Coded Text = 11100 01010 00101 00001 10001 10111 00011 10011 01001 00110 10110 00000 01000 10010 11101 10100 01111 00010 01011 11011 11110 00100 11001 00111 01101 10101 10000 11010 11000 01110 11111 01100
If each character in the input was coded in 8 bits then total bits required = 32*8 = 256 bits
Total bits of the Huffman coded document = 32*5 = 160
So ratio of the length of the Huffman coded document to the original = 160/256 = 5/8
or Compression rate: 0.625
|