Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Using Huffman code, we can compress the bits used for saving the characters in a file: Bits Table. 1. Characters count. Character Frequency E 1
Using Huffman code, we can compress the bits used for saving the characters in a file: Bits Table. 1. Characters count. Character Frequency E 1 F 1 H 1 M 1 R 1 Table 2. Character bit using Huffman code Character Frequency Total Bits Space 12 A 3 12 S 12 3 4 4 3 4 D 4 2 8 4 T 1 G 2 8 12 Y 1 4 1 D 4 2 L 2 8 4 G 2 12 N O 4 2 2 L 8 Y 4 0 4 2 1 1 5 5 N 5 3 3 4 4 4 E F H M 5 5 1 Space 5 5 1 5 S R 5 1 5 T 5 1 5 126 Total: 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) Task: Design an algorithm in pseudocode/code to print the total bits using Huffman code encoding and write down the Algorithm analysis. The complexity of the algorithm must be in O(n) and proof it! PS: you don't need to sort the input since the input is already sorted
Step 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