Question: Write a program to read a string A and display each distinct character in A, their frequencies, and the Huffman Code per distinct character in
Write a program to read a string A and display each distinct character in A, their frequencies, and the Huffman Code per distinct character in a tabular form. A sample output is listed below:

Any programming language, and for the sake of simplicity you may assume that all letters in string A are lowercase.
B. Manually draw the Huffman tree for the string A = mississippi. Please note that your Huffman tree should be correct to get credit for the following questions. Show work.
C. What will be the Huffman code for each distinct character of the string A? Show work.
D. What will be the compression ratio achieved if we use Huffman coding, instead of an 8 bit standard ASCII coding for string A? Show work. Use the following formula for compression ratio:
=
E. Based on your Huffman tree, what will the following sequence decode into? Show work. If there is any left over bit(s) you cannot decode, please specify which bit(s) they are, and explain what could be the reason for these left over bit(s).
01111010101011101000001
Enter a text: this is an example Character Codeword Frequency 3 Ea 011 001 1 101 11010 1100 0001 1000 010 1001 11011 1 1 1 1 iciil, 5 3 1 1 AK UL (total time: 6 seconds) Enter a text: this is an example Character Codeword Frequency 3 Ea 011 001 1 101 11010 1100 0001 1000 010 1001 11011 1 1 1 1 iciil, 5 3 1 1 AK UL (total time: 6 seconds)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
