卷別
資料結構與演算法
證明國立臺灣大學 2025 · 考試 · 第 19 題
(10 points) Consider the following decision problem ODDNUMBERSUM.
ODDNUMBERSUMInput: A set of positive odd numbers . A target odd number . Question: Is there an odd number of elements in whose sum is exactly ?
(a) (5 points) Prove that ODDNUMBERSUM is NP-complete.
(b) (5 points) For any set of numbers we define to be the sum of all numbers in . Let and be the input from ODDNUMBERSUM. Define to be the largest possible subset sum among all subsets whose sum does not exceed .
Let be any sufficiently small constant. Give an algorithm that computes an -approximate solution to . Specifically, your algorithm should output a value such that . The running time of your algorithm should be a polynomial of and . State the algorithm as concisely and precisely as possible. You should not write anything besides the algorithm.