Answer True or False for the following statements. Give correct answers for False statements. (20%)
(1) Let \(G\) be a graph with \(e\) edges and \(v\) vertices. If \(G\) is represented by adjacency lists, DFS requires \(O(v^2)\) time.
(2) If an AOV network represents a feasible project, its topological order is unique.
(3) In static hashing, the worst-case number of comparisons needed for a successful search is \(O(n)\) for open addressing. The number could be reduced to \(O(\log n)\) by using chaining method.
(4) Let \(d_i\) be the degree of vertex \(i\) in a graph \(G\) with \(|V|=n\) and \(|E|=e\), then \(e=\sum_{i=0}^{n-1}d_i\).
(5) The path from vertex \(u\) to vertex \(v\) on a minimal cost spanning tree of an undirected graph \(G\) is also a shortest path from \(u\) to \(v\).
(1) adjacency list 的 DFS 每個點走一次、每條邊看一次(有向 1 次、無向 2 次) → \(O(v+e)\);\(O(v^2)\) 是 adjacency matrix 的結果 → F,正確是 \(O(v+e)\)
(2) 可行(無環)的 AOV network 通常有多種 topological order,例:\(a\to c,\ b\to c\),\(abc\) 與 \(bac\) 都行;只有存在包含全部點的 Hamiltonian path 時才唯一 → F,不一定唯一
(3) open addressing 最壞 \(O(n)\),這句對;chaining 最壞所有 key 掉進同一條 chain,仍是 \(O(n)\);要 \(O(\log n)\) 得把 chain 換成 balanced BST → F,chaining 最壞也是 \(O(n)\)
(4) 每條邊貢獻 2 個 degree(握手引理) → \(\sum d_i=2e\) → F,正確是 \(e=\tfrac12\sum_{i=0}^{n-1}d_i\)
(5) MST 只保證邊權和最小,不保證兩點間最短。反例:三角形 \(w(u,w)=1,\ w(w,v)=1,\ w(u,v)=1.5\),MST 為 \(\{uw,wv\}\),但 \(u\to v\) 最短是直接 1.5 → F
(1) F (2) F (3) F (4) F (5) F