109年 地方特考 三等 資訊處理 資料結構 試卷

pdf
133.95 KB
2 頁
windows10
侵權投訴
加載中. ..
PDF
109
三等考試
資訊處理
資料結構
考試時間
2
小時
座號
禁止使用電子計算器。
本科目得以本國文字或英文作答。
代號
34580
頁次
2
1
一、請設計演算法複製一棵二元樹(copy a binary tree10分)
二、請描 order mB-tree 特性。6分)
請問 order m高度 hB-tree:⑴最多有幾個節點?最多有幾個
Key?(6分)最少有幾個節點?最少有幾個 Key?(8
三、請利用 Double Hashing 將下 key 值放入 hash table of size 13中(如表
114分)
{24, 53, 17, 46, 14, 32, 37, 92}
h1(k)=k mod 13h2(k)=1+(k mod 11)
h(k,i)=(h1(k)+i*h2(k)) mod 13 (i=0, 1,…, 12)
1
0
1
2
3
4
5
6
7
8
9
10
12
四、在一棵高 h(h=0,1,2,…)AVL tree 6AVL tree 最多
nodes nodes root h=06
假設此樹共有45nodes。請問此 AVL tree 能最高之高度及最矮
之高度各為何?(6分)
請將下列數字{17, 60, 24, 5, 7}逐步插入圖1AVLtree 中,並平衡之。
12分)
1
代號
34580
頁次
2
2
五、請利用堆積排序法(Heap Sort)將圖2逐步建立成 Min Heap並將數字
從小到大逐一列舉10分)
2
六、 KMPKnuth, Morris, Pratt)演算法寫出失敗函數(failure
function)之定義。4分)
找出 pattern “abcdabcabcdabcdabc”之失敗函數failure function(請
填入表2 failure value 14分)
假設pattern 嘗試在 string abcdabcabcdabcabcda…..”找出 pattern
pattern index 0開始比對到 index 13都一樣,而在 index 14時發現
字母不一樣,請問 pattern 如何利用 failure function 所得之結果很快
pattern 的那一位置的值要位移到
string 的那一對應位置。4分)2
index 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
string a b c d a b c a b c d a b c a b c d a
pattern a b c d a b c a b c d a b c d a b c
failure value ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
收藏 ⬇️ 下載