Question #275324

Suppose you want to encode messages containing only the following characters with their given respective frequencies: B: 55 D: 15 E: 80 G: 5 U: 45

(a) What is the minimum length bit string required to encode each character with a distinct, fixed-length code?

(b) Construct the Huffman Tree for the characters with the given frequencies. (Use the convention that when merging two vertices, the vertex with the largest count goes on the left.)

(c) Use your Huffman Tree to decode the message M = 00101010000011

(d) How many bits are required to encode the characters with the given frequencies using the Huffman Encoding and the fixed-length encoding you found in part (a)? How much storage savings does this represent?


1
Expert's answer
2022-01-18T18:19:02-0500

(a) Using two bits for each letter, we can represent different letters.

Letter 1  00Letter 2  01Letter 3  10Letter 4  11\text{Letter 1 $\rightarrow$ 00}\\ \text{Letter 2 $\rightarrow$ 01}\\ \text{Letter 3 $\rightarrow$ 10}\\ \text{Letter 4 $\rightarrow$ 11}

But here are 5 letters (B, D, E, G, U). So we will need three bits for each letter. Because maximum 23=82^3=8 letters can be represented using 3 bits.

Now total frequency = 55+15+80+5+45=200

Hence total bits required =200×3=600=200\times3=600 bits.


b)




Therefore

E=1B=0 1U=0 0 0D=0 0 1 0G=0 0 1 1E=1\\ B=0~1\\U=0~0~0\\ D=0~0~1~0\\G=0~0~1~1


c)

M=00101010000011=0010 1 01 000 0011=DEBUG\therefore M = 00101010000011=\\\underline{0010}~\underline{1}~\underline{01}~\underline{000}~\underline{0011}=DEBUG


d)

Total bits by Huffman

=80×1+55×2+45×3+15×4+5×4=405 bits=80\times 1+55\times 2+45\times 3+15\times 4+5\times 4\\=405 \text{ bits}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!
LATEST TUTORIALS
APPROVED BY CLIENTS