題組內容
二、下圖是 Huffman encoding 的一個例子:
⑵請說明最後 Code 部分 B 的編碼為何是 010?(5 分)
詳解 (共 3 筆)
詳解
Huffman encoding 步驟
1. build min heap
2.pop two smallest and put in a tree.
3.push the tree in min heap
4.iterate the step 2 and 3 until there is only on node left.
5.left node is 0, right is 1 and find the code.
詳解
從根往下推為左右左=010
詳解
B跟C是最低階,扣除第1階外處在第3階