0% found this document useful (0 votes)
14 views

Selected Problems on Huffman Code 01 - Binary Encoding

The document presents a series of problems related to Huffman coding, including tasks to obtain Huffman codes for various character sets based on given frequencies, compute the weight of the codes, and encode/decode specific messages. It also includes exercises on constructing binary encoding trees, analyzing prefix properties, and designing Huffman coding for specific probability distributions. Additionally, there are questions regarding the identification of prefix codes and constructing binary trees for different coding schemes.

Uploaded by

qwer353666
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Selected Problems on Huffman Code 01 - Binary Encoding

The document presents a series of problems related to Huffman coding, including tasks to obtain Huffman codes for various character sets based on given frequencies, compute the weight of the codes, and encode/decode specific messages. It also includes exercises on constructing binary encoding trees, analyzing prefix properties, and designing Huffman coding for specific probability distributions. Additionally, there are questions regarding the identification of prefix codes and constructing binary trees for different coding schemes.

Uploaded by

qwer353666
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Selected Problems on Huffman Code 1. Dr. Eng. Moustafa Reda A.

Eltantawi
1. Obtain the Huffman Code for the following:
Character a b c
Frequency 3 1 2
a) Find a Huffman code for the character set using the given frequencies
b) Compute the weight of the code. c) Encode the message “aabac”.
d) Decode the message 01001001.

2. Obtain the Huffman Code for the following:


Character l e h p
Frequency 2 1 4 3
a) Find a Huffman code for the character set using the given frequencies
b) Compute the weight of the code. c) Encode the message “heep”.
d) Decode the message 010010111.

3. Obtain the Huffman Code for the following:


Character s d y u t
Frequency 1 1 1 1 1
c) Find a Huffman code for the character set using the given frequencies
d) Compute the weight of the code.
e) c) Encode the message “study”.

4. Obtain the Huffman Code for the following:


Character x y ( ) + -
Frequency 1 1 1 2 2 2
a) Find a Huffman code for the character set using the given frequencies
b) Compute the weight of the code. c) Encode the message “(x+y)”.

5. Obtain the Huffman Code for the following:


Character α β + * ( )
Frequency 4 5 7 8 12 25
a) Find a Huffman code for the character set using the given frequencies.
b) Compute the weight of the code. c) Encode the message “α(α + β)”.
c) Decode the message 11001011101101111110010011010.

Selected Problems on Huffman Code 2. Dr. Eng. Moustafa Reda A. Eltantawi


6. Obtain the Huffman Code for the following:
Character U T S Y D
Frequency 11 10 4 30 5
a) Find a Huffman code for the character set using the given frequencies.
b) Compute the weight of the code. c) Encode the message “STUDY US DUST”.
d) Decode the message 11001011101101111110010011010.
e) Determine the percentage code-size-reduction.

7. Use Huffman coding to encode these symbols with given frequencies: a: 0.20,
b: 0.10, c: 0.15, d: 0.25, e: 0.30. What is the average number of bits required to
encode a character?

8. Use Huffman coding to encode these symbols with given frequencies: A: 0.10,
B: 0.25, C: 0.05, D: 0.15, E: 0.30, F: 0.07, G: 0.08. What is the average number of
bits required to encode a symbol?

9. Obtain the Huffman Code for the following:


Character h p g a r
Frequency 12 40 15 8 17
a) Find a Huffman code for the character set using the given frequencies.
b) Compute the weight of the code. c) Encode the message “gargraph”.
d) Decode the message 11001011101101111110010011010.
e) Determine the percentage code-size-reduction.

10. Obtain the Huffman Code for the following:


Character h p y d a *
Frequency 13 7 9 22 24 27
a) Find a Huffman code for the character set using the given frequencies.
b) Compute the weight of the code. c) Encode the message hypad*.
d) Decode the message 111011011101101111110010010 01.
e) Determine the percentage code-size-reduction.

Selected Problems on Huffman Code 3. Dr. Eng. Moustafa Reda A. Eltantawi


11. Construct two different Huffman codes for these symbols and frequencies:
t : 0.2, u: 0.3, v: 0.2, w: 0.3.

12. Use the table given below to draw the Binary Encoding Tree form which the
given table is constructed.
Character A B C D E F
Code 000 001 01 10 110 111
Probability 0.1 0.2 0.1 0.2 0.3 0.1

12.1 The weight of the given code is: …………………………………………………………………………………………………………………………………………………………………………………………………………………………….

12.2 Does the given code has the Prefix Property? …………………………………………………………………………………………………………………………

12.3 Write the Huffman's binary code for each of the following words:
CAD  & FACE 
………………………………………………………………………………………………………………………… …………………………………………………………………………………………………………………………

12.4 Find the word represented by each of the following codes:


001110110  & 01101110 
………………………………………………………………………………………………………………………… …………………………………………………………………………………………………………………………

13. Design a Huffman coding for each of the following messages?

13.1 P(A) = 0.10 & P(B) = 0.35 & P(C) = 0.05 & P(D) = 0.05
P(E) = 0.05 & P(F) = 0.05 & P(G) = 0.15 & P(H) = 0.2

13.2 P(A) = 0.15 & P(B) = 0.10 & P(C) = 0.05 & P(D) = 0.20
P(E) = 0.20 & P(F) = 0.20 & P(G) = 0.05 & P(H) = 0.05

14. Which of these codes are prefix codes?


a) a: 11, e: 00, t : 10, s: 01
b) a: 0, e: 1, t : 011, s: 1011
c) a: 101, e: 11, t : 001, s: 011, n: 010
d) a: 010, e: 11, t : 011, s: 1011, n: 1001, i: 10101
e) a: 0, b: 1, c: 01, d: 001, e: 0101, f: 0011, g: 1111, h: 0000

15. Construct the binary tree with prefix codes representing these coding
schemes.
a) a: 11, e: 0, t : 101, s: 100
b) a: 1, e: 01, t : 001, s: 0001, n: 00001
c) a: 1010, e: 0, t : 11, s: 1011, n: 1001, i: 10001

Selected Problems on Huffman Code 4. Dr. Eng. Moustafa Reda A. Eltantawi

You might also like