卷別
資料結構與演算法
選擇國立臺灣大學 2025 · 考試 · 第 15 題
(5 points) In this problem we use the following notations. For any binary tree , we define to be its root node, (resp. ) to be the left (resp. right) child of , and (resp. ) to be the left (resp. right) subtree of . For any vertex on a binary tree, we define , , , and similarly. These values are defined as (empty) if they do not exist. The set of leaves of are denoted as . For any statement we define to be if is true and if is false.
Let be a binary tree of nodes. Each node on has a weight and a color . We want to make the tree colorful in the sense that every non-root tree node has a color different from its parent. To do so, some re-coloring to the tree nodes are necessary, and we would like to minimize the total weights of the tree nodes that are re-colored. Notice that there are infinitely many colors available so once a node is re-colored it gets a unique color. Let be the answer. Suppose that both and are non-empty. What is the correct recursive formulations for ? Select all choice(s) that apply.
- (A)Let be the (partial) binary tree consisting of all tree node who has the same color as the tree root and all 's ancestors have the same color too. Then, , here is the weight of the maximum weighted independent set on .
- (B)With the same notion defined above, , here is the weight of the minimum weighted vertex cover on .
- (C)With the same notion defined above, , here is the weight of the minimum weighted dominating set on .
- (D).
- (E)None of the above choices apply.