in Algorithms
487 views
3 votes
3 votes

in Algorithms
by
487 views

1 Answer

0 votes
0 votes

B should be the answer (its more logical).
Logic :-


Otherwise Its probably not the Huffman encoding alone (this surely is not being asked in the question.
Due to some reasons a “1” is concatenated to the end of the string of actual path to the leaf node.

A=”0” + “1 “ =01

B=”110” + “1” = 1101

C=”100” + “1”= 1001

D = “101” + “1” =1011

E = ”111” + “1” = 1111
A,C,D could be are the matching options but question has not mentioned any such thing about concatenation so B should be the right answer.

edited by

2 Comments

lesser weights should always be on left side, and I don’t think the branching is necessary, is it?
1
1

https://web.stanford.edu/class/archive/cs/cs106b/cs106b.1126/handouts/220%20Huffman%20Encoding.pdf

https://opendsa-server.cs.vt.edu/ODSA/Books/Everything/html/Huffman.html


its more about frequencies/weights with unique path , not about arrangements, in either (inc or dec)  way it should work , provided you have taken it consistently (inc/dec).

if you are saying those from 100 , 60 ..likewise  branching , they are the way to visualize the unique tree paths.

inc=increasing

dec=decreasing

0
0