Question: In Java: Ouestion 3 Write a program to read a string A and display each distinct character in A, their frequencies, and the Huffman Code

In Java:

In Java: Ouestion 3 Write a program to read a string A

Ouestion 3 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: Enter a text: this is an example Chazacter Frequency Codeword 011 001 101 11010 1100 0001 1000 010 1001 11011 1 UL (total time: 6 seconds) for the sake of simplicity you may assume that all letters in string A are lowercase 3.B.) Manually draw the Huffiman tree for the string A - "mississippi". Please note that your Huffman tree should be correct to get credit for the following questions. Please show your work. 3.?.) What will be the Huffman code for each distinct character of the string A? Please show your work. 3.D.) What will be the compression ratio achieved if we use Huffman coding, instead of an 8 bit standard ASCII coding for string A? Please show your work. Use the following formula for compression ratio: Compression ratio 1- Huffman Coding size of text ASCII coding size of text 3.E.) Based on your Huffman tree, what will the following sequence decode into? Please show your work. 01111010101011101000001

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!