Huffman tree_哈夫曼樹_(最優(yōu)二叉樹)

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

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容