A-1依成長率排序五個函數(Stirling's Approximation)
考點:log(n!) 與 Stirling's Approximation:與 n log n 同階的證明
;、(Stirling)、 三者皆為 ; 為指數。
國立成功大學資訊管理研究所
參考答案 PDF各校參考答案的 PDF,訂閱考試資源分享信後會寄到您的信箱。訂閱領取 PDF
參考答案由作者與 AI 討論後逐題確認,不是各校公布的標準答案;若與各校公布不同,以各校為準。
最後更新:2026 年 11 月 3 日。發現錯誤歡迎來信。
這份考卷每一題的解析與手寫題的答題範例,收在《資管所考古題 111-115 計概資結全解》,可以免費試閱。
考點:log(n!) 與 Stirling's Approximation:與 n log n 同階的證明
;、(Stirling)、 三者皆為 ; 為指數。
考點:Binary Heap 與 Fibonacci Heap 操作複雜度比較表
Heap(Priority Queue)。持續插入新訊息並反覆取出優先權最高者,Insert 與 Extract 皆為 。
考點:Stack 與 Queue 定義與應用場景
Queue。依收單先後出餐為 FIFO,新訂單從隊尾 enqueue、完成的從隊首 dequeue,皆為 。
考點:Binary Search Tree 基礎應用場景:為何選擇 BST(O(log n) 搜尋、有序輸出)
AVL Tree。資料保持有序,inorder 走訪 即得排序名單;依名字查詢與插入新球員皆為 。
考點:B-tree 與 B+tree 比較(含區塊大小影響)
B-tree。節點大小對齊磁碟區塊、fanout 高使樹很矮,插入只需 次磁碟存取,適合大量外部資料的頻繁插入。
考點:Move-to-front List:定義、Find 操作與適用情境
Move-to-front List。資料不可比較,AVL Tree 無法依大小建樹;Move-to-front List 只需判斷相等,且每次 Find 後把該元素移到最前端,常被查的資料很快就能找到。
考點:Quick Sort:DS版/Algo版 Partition 邏輯與 Worst-case 成因(Partition Three/Three-way Partition)
void rearrange(int b[], int n) {
int start = 0, end = n - 1, i = 0, t;
while (i <= end) {
if (b[i] < 0) { /* 負數 → 換到左區 */
t = b[i]; b[i] = b[start]; b[start] = t;
start++; i++;
} else if (b[i] > 0) { /* 正數 → 換到右區,i 不前進 */
t = b[i]; b[i] = b[end]; b[end] = t;
end--;
} else { /* 零 → 留在中區 */
i++;
}
}
}
考點:k-ary Heap(k 元堆積):陣列索引公式與插入/刪除邏輯推廣
最終 heap(層序,A[0] 為根):[1, 4, 2, 3, 6, 5, 9, 8, 7]
考點:k-ary Heap(k 元堆積):陣列索引公式與插入/刪除邏輯推廣
最終 heap(層序,A[0] 為根):[2, 4, 7, 3, 6, 5, 9, 8]
考點:k-ary Heap(k 元堆積):陣列索引公式與插入/刪除邏輯推廣
left:;middle:;right:
考點:AVL Tree 節點數上下界與最佳/最差高度
最少 33、最多 127。
考點:AVL Tree 插入與四種旋轉(LL/RR/LR/RL)調整規則
最少 0 次、最多 1 次。插入後只需對第一個失衡節點做一次單旋或雙旋,該子樹高度即恢復插入前的值,祖先不再失衡。
考點:Quick Sort:DS版/Algo版 Partition 邏輯與 Worst-case 成因(Partition Three/Three-way Partition)
取首、中、尾三個元素的中位數為 pivot。本例首 11、中 7(index 6)、尾 35,中位數為 11,pivot 。
考點:Quick Sort:DS版/Algo版 Partition 邏輯與 Worst-case 成因(Partition Three/Three-way Partition)
第 1 層:pivot 11 → [6, 7, 1, 10]|[19, 13, 20, 21, 15, 14, 17, 35]
第 2 層:pivot 7 → [6, 1]|[10];pivot 21 → [19, 13, 20, 15, 14, 17]|[35]
第 3 層:pivot 6 → [1]|(空);pivot 19 → [13, 15, 14, 17]|[20]
第 4 層:pivot 15 → [13, 14]|[17]
第 5 層:pivot 13 → (空)|[14]
排序結果:1, 6, 7, 10, 11, 13, 14, 15, 17, 19, 20, 21, 35
考點:利用 Back Edge 偵測 Cycle
hasCycle(G):
for each v in V: visited[v] = false
for each v in V:
if not visited[v] and dfs(v, -1): return true
return false
dfs(u, parent):
visited[u] = true
for each w in adj[u]:
if not visited[w]:
if dfs(w, u): return true
else if w != parent: # 非沿路來源的邊繞回已走訪節點
return true
return false
考點:BFS 與 DFS:定義、範例與比較
Stack 存 (vertex, parent),鄰居由大到小 push,使較小者先 pop;pop 出未訪問的頂點即加入 tree edge。
Stack 變化(左為頂):[(1,–)] → [(2,1),(4,1)] → [(3,2),(5,2),(4,1)] → [(5,3),(5,2),(4,1)] → [(5,2),(4,1)] → [(4,1)] → []
Spanning Tree 邊集合:1-2、2-3、3-5、1-4
考點:Minimum Spanning Tree(MST)與求解演算法(Kruskal's、Prim's)
最大 degree 為 4(頂點 9),取分量 。
邊依權重排序後逐一檢查:加入 、、、;、 成環捨棄;加入 。
MST 邊集合:、、、、,總權重 13。
考點:最短路徑演算法比較表(DAG、Dijkstra's、Bellman-Ford's、Floyd-Warshall's)
Floyd(W, n):
for i = 1 to n:
for j = 1 to n:
c[i][j] = W[i][j] # 直接邊的權重,無邊為 INF,i=j 為 0
for k = 1 to n: # k 必須在最外層
for i = 1 to n:
for j = 1 to n:
if c[i][k] + c[k][j] < c[i][j]:
c[i][j] = c[i][k] + c[k][j]
return c
, 時即為 all-pairs 最短距離。
考點:最短路徑演算法比較表(DAG、Dijkstra's、Bellman-Ford's、Floyd-Warshall's)
考點:Hash Function 與雜湊表(Hash Table)基本概念
選 11。除法雜湊的除數應取質數:8、9、27 分別為 、、,取餘數時 key 的規律(低位元、3 的倍數)會保留下來,使餘數集中在少數 bucket;11 是質數,最能把 key 平均分散。
考點:Bloom Filter:機率型集合成員測試與 Differential File 應用