卷別
資料結構與演算法
選擇國立臺灣大學 2025 · 考試 · 第 14 題
考科演算法
(5 points) Let be an grid graph, with each undirected edge having a certain weight. Specifically, the vertices of can be labeled as where . There is an edge between and if and only if . Suppose we want to compute the value of a minimum cut that separates and . The value of a cut is defined as the sum of weights of all edges crossing the cut.
Four students proposed different ideas for solving this task. Let us examine their approaches and select all correct statement(s) below.
- (A)Student A: Some minimum cut must cut through at most edges. Since there are edges in , we can design a brute force algorithm that enumerates at most subsets of edges and check: if the removal of those edges separates and . Any such subset leads to a candidate for the minimum cut.
- (B)Student B: For some minimum cut, the crossing edges must form a monotonic path from to . In other words, those edges form a path of exactly edges from to . Thus, we can solve this problem via dynamic programming.
- (C)Student C: Why don't we simply compute a maximum flow and then turning it to a minimum cut? First, construct a flow network by letting be the source and be the sink. For each undirected edge connecting and , create two directed edges in opposite directions, both with capacities equal to that edge's weight. By using Dinitz's (Dinic's) algorithm, the maximum flow from to can be computed in . Using the Max-Flow Min-Cut Theorem, the returned maximum flow value equals the value of the minimum cut.
- (D)Student D: To separate and , for some minimum cut, the crossing edges must form a shortest path from the south-west border to the north-east border . Thus, we can run the Bellman-Ford algorithm that seeks for any shortest path from a vertex in to any vertex in . Finally, the length of the shortest path is the value of the minimum cut.
- (E)None of the above choices.