What is the average length encoding of a letter for a huffman code of these letters and their frequencies: a : 0.15, b : 0.25, c : 0.20, d : 0.35, e : 0.05?

Respuesta :

The average length encoding of a letter for a Huffman code of the letters and their given frequencies will be 245.

We have,

Frequencies:

a = 0.15 = 15,

b = 0.25 = 25,

c = 0.20 = 20,

d = 0.35 = 35,

e = 0.05 = 5,

So,

Now,

According to the question,

We will make Huffman tree,

i.e.

a = 0.15 = 15,

b + c = 25 + 20 = 45

d + e = 35 + 5 = 40,

Now,

a + b + c + d + e = 100

So,

a = 11 = 2 digits

b = 101 = 3 digits

c= 100 = 3 digits

d= 01 = 2 digits

e= 00 = 2 digits

And,

We know that,

Total bits required to represent Huffman code = 12.

So,

Now,

The average code length = a * 2 digits + b * 3 digits + c * 3 digits + d * 2 digits + e * 2 digits

i.e.

The average code length = 15 × 2 + 25 × 3 + 20 × 3 + 35 × 2 + 5 × 2

On solving we get,

The average code length = 245

Hence we can say that the average length encoding of a letter for a Huffman code of the letters and their given frequencies will be 245.

Learn more about Huffman code here

https://brainly.com/question/18916556

#SPJ4

ACCESS MORE
ACCESS MORE
ACCESS MORE
ACCESS MORE