Appendix B - NP-Completeness
Published online by Cambridge University Press: 05 June 2012
Summary
In this appendix, we briefly review the concepts of NP-completeness and reductions. We will use the knapsack problem of Section 3.1 as a running example. Recall that in the knapsack problem, we are given a set of n items I = {1, …, n}, where each item i has a value vi and a size si. All sizes and values are positive integers. The knapsack has capacity B, where B is also a positive integer. The goal is to find a subset of items S ⊆ I that maximizes the value ∑i∈Svi of items in the knapsack subject to the constraint that the total size of these items is no more than the capacity; that is, ∑i∈Ssi ≤ B.
Recall the definition of a polynomial-time algorithm.
Definition B.1.An algorithm for a problem is said to run in polynomial time, or said to be a polynomial-time algorithm, with respect to a particular model of computer (such as a RAM) if the number of instructions executed by the algorithm can be bounded by a polynomial in the size of the input.
More formally, let x denote an instance of a given problem; for example, an instance of the knapsack problem is the number n of items, the numbers si and vi giving the sizes and values of the items, and the number B giving the size of the knapsack.
- Type
- Chapter
- Information
- The Design of Approximation Algorithms , pp. 465 - 468Publisher: Cambridge University PressPrint publication year: 2011