11.07.2015 Views

Data Structures and Algorithm Analysis - Computer Science at ...

Data Structures and Algorithm Analysis - Computer Science at ...

Data Structures and Algorithm Analysis - Computer Science at ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Sec. 17.2 Hard Problems 545so this algorithm cannot be converted to a polynomial time algorithm on a regularcomputer. Nor does anybody in the world know of any other polynomial timealgorithm to solve TRAVELING SALESMAN on a regular computer, despite thefact th<strong>at</strong> the problem has been studied extensively by many computer scientists formany years.It turns out th<strong>at</strong> there is a large collection of problems with this property: Weknow efficient non-deterministic algorithms, but we do not know if there are efficientdeterministic algorithms. At the same time, we have not been able to proveth<strong>at</strong> any of these problems do not have efficient deterministic algorithms. This classof problems is called N P-complete. Wh<strong>at</strong> is truly strange <strong>and</strong> fascin<strong>at</strong>ing aboutN P-complete problems is th<strong>at</strong> if anybody ever finds the solution to any one ofthem th<strong>at</strong> runs in polynomial time on a regular computer, then by a series of reductions,every other problem th<strong>at</strong> is in N P can also be solved in polynomial time ona regular computer!Define a problem to be N P-hard if any problem in N P can be reduced to Xin polynomial time. Thus, X is as hard as any problem in N P. A problem X isdefined to be N P-complete if1. X is in N P, <strong>and</strong>2. X is N P-hard.The requirement th<strong>at</strong> a problem be N P-hard might seem to be impossible, butin fact there are hundreds of such problems, including TRAVELING SALESMAN.Another such problem is called K-CLIQUE.K-CLIQUEInput: An arbitrary undirected graph G <strong>and</strong> an integer k.Output: YES if there is a complete subgraph of <strong>at</strong> least k vertices, <strong>and</strong> NOotherwise.Nobody knows whether there is a polynomial time solution for K-CLIQUE, but ifsuch an algorithm is found for K-CLIQUE or for TRAVELING SALESMAN, thenth<strong>at</strong> solution can be modified to solve the other, or any other problem in N P, inpolynomial time.The primary theoretical advantage of knowing th<strong>at</strong> a problem P1 is N P-completeis th<strong>at</strong> it can be used to show th<strong>at</strong> another problem P2 is N P-complete. This isdone by finding a polynomial time reduction of P1 to P2. Because we already knowth<strong>at</strong> all problems in N P can be reduced to P1 in polynomial time (by the definitionof N P-complete), we now know th<strong>at</strong> all problems can be reduced to P2 as well bythe simple algorithm of reducing to P1 <strong>and</strong> then from there reducing to P2.There is a practical advantage to knowing th<strong>at</strong> a problem is N P-complete. Itrel<strong>at</strong>es to knowing th<strong>at</strong> if a polynomial time solution can be found for any prob-

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!