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:

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

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!

 

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
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
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY