Create a Huffman tree to encode the message (the quotation marks are not part of the message)
“SONGS SUNG LOUDLY SOUND LOVELY”
The initial queue of the Huffman trees is shown below:
E1 V1 D2 G2 Y2 N3 U3 L4 O4 S4 <Space>4
Continue the process and always place the newly create tree on the right of other trees with the same priority.
In your answer, you must show the queue each time it is changed.
2 4
E V => D 2
E V
4 6
G Y => N U
8
4 4 8 8
D 2 G Y => L O => S <>
E V
14 16
6 8 => 8 8
N U S <> 4 4 L O
D 2 G Y
E V
30
14 16
6 8 8 8
N U S <> 4 4 L O
D 2 G Y
E V
Draw the associated code table. The letters are to be listed in alphabetical order. You only
need to include the codes for characters that appear in the message given above.
N:000; U:001; S:010; <>:011; L:110; O:111;
D:1000; G:1010; Y:1011;
E:10010; V:10011
网友评论