1 / 15

NP-Complete Problems

NP-Complete Problems. NP and P. What is NP?

Download Presentation

NP-Complete Problems

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. NP-Complete Problems

  2. NP and P • What is NP? • NP is the set of all decision problems (question with yes-or-no answer) for which the 'yes'-answers can be verified in polynomial time (O(n^k) where n is the problem size, and k is a constant) by a deterministic Turing machine. Polynomial time is sometimes used as the definition of fast or quickly. • What is P? • P is the set of all decision problems which can be solved in polynomial time by a deterministic Turing machine. Since it can solve in polynomial time, it can also be verified in polynomial time. Therefore P is a subset of NP.

  3. Class of “P” Problems • Class P consists of (decision) problems that are solvable in polynomial time • Polynomial-time algorithms • Worst-case running time is O(nk), for some constant k • Examples of polynomial time: • O(n2), O(n3), O(1), O(n lg n) • Examples of non-polynomial time: • O(2n), O(nn), O(n!)

  4. Class of “NP” Problems • Class NP consists of problems that could be solved by NP algorithms • i.e., verifiable in polynomial time • If we were given a “certificate” of a solution, we could verify that the certificate is correct in time polynomial to the size of the input • Warning: NP does not mean “non-polynomial”

  5. NP-Complete • What is NP-Complete? • A problem x that is in NP is also in NP-Complete if and only if every other problem in NP can be quickly (ie. in polynomial time) transformed into x. In other words: • x is in NP, and • Every problem in NP is reducible to x • So what makes NP-Complete so interesting is that if any one of the NP-Complete problems was to be solved quickly then all NP problems can be solved quickly

  6. NP-Hard • What is NP-Hard? • NP-Hard are problems that are at least as hard as the hardest problems in NP. Note that NP-Complete problems are also NP-hard. However not all NP-hard problems are NP (or even a decision problem), despite having 'NP' as a prefix. That is the NP in NP-hard does not mean 'non-deterministic polynomial time'. Yes this is confusing but its usage is entrenched and unlikely to change.

  7. Tractable/Intractable Problems • Problems in P are also called tractable • Problems not in P are intractable or unsolvable • Can be solved in reasonable time only for small inputs • Or, can not be solved at all • Are non-polynomial algorithms always worst than polynomial algorithms? - n1,000,000 is technically tractable, but really impossible - nlog log log n is technically intractable, but easy

  8. Reductions yes yes   f Problem B no no Problem A • Reduction is a way of saying that one problem is “easier” than another. • We say that problem A is easier than problem B, (i.e., we write “A  B”) if we can solve A using the algorithm that solves B. • Idea:transform the inputs of A to inputs of B

  9. Polynomial Reductions • Given two problems A, B, we say that A is polynomially reducible to B (A p B) if: • There exists a function f that converts the input of A to inputs of B in polynomial time • A(i) = YES  B(f(i)) = YES

  10. NP-Complete Problems

  11. Traveling Salesman

  12. 5-Clique

  13. Hamiltonian Path

  14. Map Coloring

  15. Vertex Cover(VC) • Given a graph and an integer k, is there a collection of k vertices such that each edge is connected to one of the vertices in the collection?

More Related