background preloader

P ?= NP

Facebook Twitter

P (complexity) In computational complexity theory, P, also known as PTIME or DTIME(nO(1)), is one of the most fundamental complexity classes.

P (complexity)

It contains all decision problems that can be solved by a deterministic Turing machine using a polynomial amount of computation time, or polynomial time. Cobham's thesis holds that P is the class of computational problems that are "efficiently solvable" or "tractable"; in practice, some problems not known to be in P have practical solutions, and some that are in P do not, but this is a useful rule of thumb. A language L is in P if and only if there exists a deterministic Turing machine M, such that M runs for polynomial time on all inputsFor all x in L, M outputs 1For all x not in L, M outputs 0 P can also be viewed as a uniform family of boolean circuits. . , such that For all , takes n bits as input and outputs 1 bitFor all x in L, For all x not in L, The circuit definition can be weakened to use only a logspace uniform family without changing the complexity class.

NP (complexity) In computational complexity theory, NP is one of the most fundamental complexity classes.

NP (complexity)

The abbreviation NP refers to "nondeterministic polynomial time. " Intuitively, NP is the set of all decision problems for which the instances where the answer is "yes" have efficiently verifiable proofs of the fact that the answer is indeed "yes". More precisely, these proofs have to be verifiable in polynomial time by a deterministic Turing machine.

In an equivalent formal definition, NP is the set of decision problems where the "yes"-instances can be accepted in polynomial time by a non-deterministic Turing machine. The equivalence of the two definitions follows from the fact that an algorithm on such a non-deterministic machine consists of two phases, the first of which consists of a guess about the solution, which is generated in a non-deterministic way, while the second consists of a deterministic algorithm that verifies or rejects the guess as a valid solution to the problem.[2] Thomas H. NP-hard. As consequences of the definition, the following claims can be made: Examples[edit] An example of an NP-hard problem is the decision subset sum problem, which is this: given a set of integers, does any non-empty subset of them add up to zero?

NP-hard

That is a decision problem, and happens to be NP-complete. Another example of an NP-hard problem is the optimization problem of finding the least-cost cyclic route through all nodes of a weighted graph. This is commonly known as the traveling salesman problem. There are decision problems that are NP-hard but not NP-complete, for example the halting problem. Alternative definitions[edit] An alternative definition of NP-hard that is often used restricts NP-hard to decision problems and then uses polynomial-time many-one reduction instead of Turing reduction.

NP-naming convention[edit] NP-hard problems do not have to be elements of the complexity class NP, despite having NP as the prefix of their class name. NP-complete. Although any given solution to an NP-complete problem can be verified quickly (in polynomial time), there is no known efficient way to locate a solution in the first place; indeed, the most notable characteristic of NP-complete problems is that no fast solution to them is known.

NP-complete

That is, the time required to solve the problem using any currently known algorithm increases very quickly as the size of the problem grows. As a consequence, determining whether or not it is possible to solve these problems quickly, called the P versus NP problem, is one of the principal unsolved problems in computer science today. Overview[edit] Formal definition of NP-completeness[edit] A decision problem is NP-complete if: is in NP, andEvery problem in NP is reducible to in polynomial time.[1] can be shown to be in NP by demonstrating that a candidate solution to can be verified in polynomial time.

Note that a problem satisfying condition 2 is said to be NP-hard, whether or not it satisfies condition 1.[2]