P. 1


|Views: 9,685|Likes:
Published by Meena Bhagavathula

More info:

Published by: Meena Bhagavathula on Mar 12, 2011
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less





In the previous chapters, we have been working mostly with the design and
analysis of those algorithms for which the running time can be expressed
in terms of a polynomial of low degree, say 3. In this chapter, we turn our
attention to a class of problems for which no efficient algorithms have been
found. Moreover, it is unlikely that an efficient algorithm will someday
be discovered for any one of these problems. Let Π be any problem. We
say that there exists a polynomial time algorithm to solve problem Π if
there exists an algorithm for Π whose time complexity is O(nk

), where n
is the input size and k is a nonnegative integer. It turns out that many of
the interesting real world problems do not fall into this category, as their
solution requires an amount of time that is measured in terms of exponential
and hyperexponential functions, e.g. 2n

and n!. It has been agreed upon
in the computer science community to refer to those problems for which
there exist polynomial time algorithms as tractable, and those for which it
is unlikely that there exist polynomial time algorithms as intractable.
In this chapter, we will study a subclass of intractable problems, com-
monly referred to as the class of NP-complete problems. This class contains,
among many others, hundreds of well-known problems having the common
property that if one of them is solvable in polynomial time, then all the
others are solvable in polynomial time. Interestingly, many of these are
natural problems in the sense that they arise in real world applications.
Moreover, the running times of the existing algorithms to solve these prob-
lems are invariably measured in terms of hundreds or thousands of years



NP-complete Problems

for inputs of moderate size (see Table 1.1 on page 24).
When studying the theory of NP-completeness, it is easier to restate a
problem so that its solution has only two outcomes: yes or no. In this case,
the problem is called a decision problem. In contrast, an optimization prob-
lem is a problem that is concerned with the minimization or maximization
of a certain quantity. In the previous chapters, we have encountered numer-
ous optimization problems, like finding the minimum or maximum in a list
of elements, finding the shortest path in a directed graph and computing a
minimum cost spanning tree of an undirected graph. In the following, we
give three examples of how to formulate a problem as a decision problem
and an optimization problem.

Example 10.1 Let S be a sequence of real numbers. The ELEMENT
UNIQUENESS problem asks whether all the numbers in S are distinct.

Rephrased as a decision problem, we have

Decision problem: element uniqueness.

Input: A sequence S of integers.

Question: Are there two elements in S that are equal?

Stated as an optimization problem, we are interested in finding an element in

S of highest frequency. For instance, if S = 1,5,4,5,6,5,4, then 5 is of highest

frequency since it appears in the sequence 3 times, which is maximum. Let us call

this optimization version element count. This version can be stated as follows.

Optimization problem: element count.

Input: A sequence S of integers.

Output: An element in S of highest frequency.

This problem can be solved in optimal O(nlogn) time in the obvious way, which

means it is tractable.

Example 10.2 Given an undirected graph G = (V,E), a coloring of G using
k colors is an assignment of one of k colors to each vertex in V in such a way

that no two adjacent vertices have the same color. The coloring problem asks

whether it is possible to color an undirected graph using a specified number of

colors. Formulated as a decision problem, we have

Decision problem: coloring.

Input: An undirected graph G = (V,E) and a positive integer k ≥ 1.

Question: Is G k-colorable?, i.e., can G be colored using at most k colors?

This problem is intractable. If k is restricted to 3, the problem reduces to the

well-known 3-coloring problem, which is also intractable even when the graph

is planar.

An optimization version of this problem asks for the minimum number of colors

needed to color a graph in such a way that no two adjacent vertices have the

same color. This number, denoted by χ(G), is called the chromatic number of G.



Optimization problem: chromatic number.

Input: An undirected graph G = (V,E).

Output: The chromatic number of G.

Example 10.3 Given an undirected graph G = (V,E), a clique of size k in
G, for some positive integer k, is a complete subgraph of G with k vertices. The

clique problem asks whether an undirected graph contains a clique of a specified

size. Rephrased as a decision problem, we have

Decision problem: clique.

Input: An undirected graph G = (V,E) and a positive integer k.

Question: Does G have a clique of size k?

The optimization version of this problem asks for the maximum number k such

that G contains a clique of size k, but no clique of size k + 1. We will call this

problem max-clique.

Optimization problem: max-clique.

Input: An undirected graph G = (V,E).

Output: A positive integer k, which is the maximum clique size in G.

If we have an efficient algorithm that solves a decision problem, then
it can easily be modified to solve its corresponding optimization problem.
For instance, if we have an algorithm A that solves the decision problem for
graph coloring, we can find the chromatic number of a graph G using binary
search and Algorithm A as a subroutine. Clearly, 1 ≤ χ(G) ≤ n, where n
is the number of vertices in G. Hence, the chromatic number of G can be
found using only O(logn) calls to algorithm A. Since we are dealing with
polynomial time algorithms, the logn factor is inconsequential. Because
of this reason, in the study of NP-complete problems, and computational
complexity or even computability in general, it is easier to restrict one’s
attention to decision problems.
It is customary in the study of NP-completeness, or computational com-
plexity in general, to adopt a formal model of computation such as the
Turing machine model of computation, as it makes the topic more formal
and the proofs more rigorous. In this chapter, however, we will work with
the abstract notion of “algorithm”, and will not attempt to formalize it by
associating it with any model of computation. A more formal treatment
that uses the Turing machine as a model of computation can be found in
Chapter 11.


NP-complete Problems

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->