in Algorithms
2,651 views
1 vote
1 vote
The following message is:
GATE2018GAATTTEEEE22000011188
What is the average length of bits required for encoding each letter using Huffman coding___?
in Algorithms
2.7k views

2 Comments

is it 3.034?
0
0
given 2.71 but i am getting 1.71
0
0

3 Answers

4 votes
4 votes
Best answer

....

selected by

1 comment

Neat๐Ÿ‘Œ
0
0
0 votes
0 votes
Answer is 2.7..

G-1100

A-1101

T-100

E-111

2-010

0-00

1-01

8-011

Avg length =

(4*2 + 4*3 +3*4 +3*5 +3*3 + 2*5 +2 *4 + 2*3)/29= 2.7

8 Comments

can u provide your huffman tree?
0
0

Huff

0
0
According to your tree its 87/29 = 3
0
0
Plz Cross check with above data.. I m getting 80/29
0
0

vamp_vaibhav  frequency of 8 is 3 and length is also 3 so it should be 3*3 & frequency of 1 is 4 and length (according to your tree diagram is 3) so it should be 4*3

1
1
Yes you are right.. I made mistake..
0
0
For this particular question different trees are possible with different Avg values.. Isn't??
0
0
yes its 87/29=3 its coming...
0
0
0 votes
0 votes
I am following occurences * bits

G = 2*4

A = 3*4

T = 4*3

E = 5*3

2 = 3*3

0 = 5*2

1 = 4*3

8 = 3*3

sum = 87

by adding all occrences = 29

and hence Avg bits = 87/29 = 3.