113 交大資演 Part 2 參考詳解
採用 CC BY-NC-SA 4.0 許可協議共享,轉載請註明來源,禁止任何營利使用。
SayASun, Feb 4, 2024 9:33 AM
1. B-Tree of order M
- (A) The answer is not unique
- trv1: level order(BFS)
- trv2: preorder(DFS, DLR)
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
- (B)
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
- (C)
We can sort sequence of any order, and sorted sequence will be inorder of BST, so it implies inorder.
Ans: preorder, postorder, level-order
- (D)
- In Horowitz's definition of a B-Tree, the new key participates in the split. So M-way Search Tree at most contains keys and pointers before balancing process.
- Notice that keys store in , and childs stroe in
- Ans:
- (E)
- B-Tree of order M have -node to -node, and a M-node has keys after balancing.
- For example, there are 2-node, 3-node, 4-node in 2-3-4 Tree (B-Tree of order 4).
- Ans:
2. Bellman-Ford
|
A |
B |
C |
D |
initial |
INF |
INF |
INF |
INF |
round 1 |
0 |
-1 |
-4 |
3 |
round 2 |
0 |
-1 |
-4 |
0 |
round 3 |
0 |
-1 |
-4 |
0 |
3. Longest Palindrome Bimodal Subsequence Problem (LPBS)
- 長度為 的LPBS,其
pivot
為。也就是以為中點,前半段是Increasing,後半段是Decreasing。
- 因此求以 為pivot的LPBS,可以將問題分隔成以結尾的LIS,和以開始的LDS兩個部分。
- 以 結尾的LIS即為 ,令以 開始的LDS為 :
- 註:題目的 中implies 為 ,我這裡定義的 也假設 為
- 因為兩段長度要相同,且 重疊於兩段,故所求為
4. Binary Search
- (A) 由
勘根定理
證存在性
- (B) 證明單調性,可二分
- 所以 為嚴格遞減函數,具有單調性
- 因此可以透過Binary Seach縮小答案範圍,when , return r