判斷題
1.Given a Huffman tree for N (≥2) characters, all with different weights. The weight of any non-leaf node must be no less than the weight of any node on the next lower level.
2.Let C be an alphabet in which each character c in C has frequency c.freq. If the size of C is n, the length of the optimal prefix code for any character c is not greater than n−1.
3.哈夫曼編碼是一種最優的前綴碼。對一個給定的字符集及其字符頻率,其哈夫曼編碼不一定是唯一的,但是每個字符的哈夫曼碼的長度一定是唯一的。
選擇題
1.對N(N≥2)個權值均不相同的字符構造哈夫曼樹。下列關於該哈夫曼樹的敘述中,錯誤的是:
B.樹中兩個權值最小的結點一定是兄弟結點
C.樹中任一非葉結點的權值一定不小於下一層任一結點的權值
D.該樹一定是一棵完全二叉樹
2.由分別帶權為9、2、5、7的四個葉子結點構成一棵哈夫曼樹,該樹的帶權路徑長度為:
B.37
C.44
D.46
3.Given a piece of text which consists of characters {a, b, c, d}, with the frequencies of occurrence being {4, 2, 5, 1}, respectively. How many bits are saved by Huffman code comparing to the equal-length code?
B.2
C.4
D.5
4.哈夫曼樹是n個帶權葉子結點構成的所有二叉樹中()最小的二叉樹。
B.高度
C.帶權路徑長度
D.度
5.關於Huffamn樹,如下說法錯誤的是( )
B.Huffman樹中,任意調整結點左右孩子的順序,不影響帶權路徑長度
C.Huffamn樹的帶權路徑長度最大
D.Huffman樹中,權值越大的葉子結點離根結點越近
6.設給定權值總數有n 個,其哈夫曼樹的結點總數為( )。
B.2n+1
C.2n-1
D.不確定
7.設哈夫曼樹中有199個結點,則該哈夫曼樹中有()個葉子結點。
B.100
C.101
D.102
8.Given a set of characters { a, b, c, d, e, f } with their occurrence frequencies being { 6, 3, 8, 2, 10, 4 }, respectively. Which of the following is a correct set of the corresponding Huffman codes?
B.00, 100, 110, 000, 0010, 01
C.10, 1011, 11, 0011, 00, 010
D.0011, 10, 11, 0010, 01, 000
9.設有13個值,用它們構成一棵哈夫曼樹,則該哈夫曼樹共有結點數是( )。
B.12
C.26
D.25
10.以下關於huffman樹說法錯誤的是( )。
B.huffman樹中沒有度數為1的分支結點
C.若初始森林中共有n棵二叉樹,最終求得的huffman樹共有2n-1個結點
D.若初始森林中共有n棵二叉樹,進行2n-1次合並后才能剩下一棵最終的huffman樹
11.設一段文本中包含4個對象{a,b,c,d},其出現次數相應為{4,2,5,1},則該段文本的哈夫曼編碼比采用等長方式的編碼節省了多少位數?
B.2
C.4
D.5
12.Construct a Huffman tree from four leaf nodes with weights 9, 2, 5 and 7. Then the weighted path length of this Huffman tree is:
B.37
C.44
D.46
13.根據使用頻率為5個字符設計的哈夫曼編碼不可能是( )。
B.000,001,010,011,1
C.100,11,10,1,0
D.001,000,01,11,10
14.已知權值集合為{5,7,2,3,6,1,4},計算帶權路徑長度WPL()。
B.74
C.75
D.76
15.對 n 個互不相同的符號進行哈夫曼編碼。若生成的哈夫曼樹共有 115 個結點,則 n 的值是:
B.57
C.58
D.60