# Using Huffman code,we can compress the bits used for saving the characters in a file : Table

Using Huffman code,we can compress the bits used for saving the characters in a file : Table.1. Characters count. [Table image below] Table 2. Character bit using Huffman code [Table image below] Total bits used for saving the character in table 1 is264 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 to print the total bits using Huffman code encoding and write down the Algorithmanalysis. The complexity of the algorithm must be in O(n)andproof it! ➢ PS: you don’t need to sort the input since the input is already sorted! Transcribed Image Text: Table.1. Characters count.
Table 2. Character bit using Huffman code
Character Frequency
Character
Bits
Frequency
Total
E
Bits
F
1
Space
3
4
12
A
3
4
12
H
1
M
S
3
4
12
D
4
2
8
R
1
G
4
8
4
3
12
Y
L
4
2
8
D
2
4
3
12
G
2
4
2
8
Y
4
1
4
2
E
5
3
F
5
1
N
3
H
5
Space
4
M
5
1
5
A
4
R
5
1
5
4
5
1
Total:
126

-25-