Question: USE C/C++ Programming Language Total bits used for saving the character in table 1 is 264 bits using standard ASCII 8 bits for 1 character.

USE C/C++ Programming Language

USE C/C++ Programming Language Total bits used for saving the character in

Total bits used for saving the character in table 1 is 264 bits using standard ASCII 8 bits for 1 character.

Using Huffman code encoding in Table 2, the total bits used is 126 bits.

The problem:

Input: list of characters such as table 1

Output: Total bits using Huffman code Encoding (table 2) // Just Output The Total Bits Used

Task: Print the Total bits using Huffman code encoding. The complexity of the algorithm must be in O(n)!

PS: You Dont Need to Sort the input since the input is Already Sorted!

Using Huffman code, we can compress the bits used for saving the characters in a file: Table. 1. Characters count. Character Frequency E 1 F 1 H 1 M 1 R 1 1 T Y 1 D 2 Table 2. Character bit using Huffman code Character Bits Frequency Total Bits Space 3 4 12 A 3 4 12 S 3 4 12 D 4 2 8 G 4 2 8 1 4 3 12 L 4 2 8 N 4 3 12 0 4 2 8 Y 4 1 4 E 5 1 5 F 5 1 5 H 5 1 5 M 5 1 5 R 5 1 5 T 5 1 5 G 2 L 2 2 0 I 3 N 3 4 Space A 4 S 4 Total: 126 Using Huffman code, we can compress the bits used for saving the characters in a file: Table. 1. Characters count. Character Frequency E 1 F 1 H 1 M 1 R 1 1 T Y 1 D 2 Table 2. Character bit using Huffman code Character Bits Frequency Total Bits Space 3 4 12 A 3 4 12 S 3 4 12 D 4 2 8 G 4 2 8 1 4 3 12 L 4 2 8 N 4 3 12 0 4 2 8 Y 4 1 4 E 5 1 5 F 5 1 5 H 5 1 5 M 5 1 5 R 5 1 5 T 5 1 5 G 2 L 2 2 0 I 3 N 3 4 Space A 4 S 4 Total: 126

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!