96 Chap. 15 Limits to Computation 15.8 Represent a real number in a bin as an in f nite column of binary digits, simi-lar to the representation of functions in Figure 15.4. Now we can use a simple diagonalization proof. Assume that some assignment of real numbers to in-tegers is proposed. We can construct a new real number that has not been assigned by taking the f rst bit of the number assigned to “1” and F ipping it; take the second bit of the number assigned to “2” and F ip it; and so on. 15.9 Clearly, KNAPSACK is in NP , since we can just guess a set of items and test in polynomial time if its size is less than k and its value greater than v . To prove that KNAPSACK is NP-hard, we reduce from the known NP-complete problem EXACT KNAPSACK. EXACT KNAPSACK takes as in-put some items with sizes and a value k . To convert this input to an input for KNAPSACK, we give each item a value equal to its size. We set v = k .We now give this input to KNAPSACK. If KNAPSACK returns “NO” then there is no solution for EXACT KNAP-
This is the end of the preview. Sign up
access the rest of the document.
This note was uploaded on 12/27/2011 for the course MAP 2302 taught by Professor Bell,d during the Fall '08 term at UNF.