Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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: 126Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started