NP-complete problem | Definition, Examples, & Facts (2024)

mathematics

verifiedCite

While every effort has been made to follow citation style rules, there may be some discrepancies.Please refer to the appropriate style manual or other sources if you have any questions.

Select Citation Style

Print

verifiedCite

While every effort has been made to follow citation style rules, there may be some discrepancies.Please refer to the appropriate style manual or other sources if you have any questions.

Select Citation Style

Feedback

Thank you for your feedback

Our editors will review what you’ve submitted and determine whether to revise the article.

NP-complete problem, any of a class of computational problems for which no efficient solution algorithm has been found. Many significant computer-science problems belong to this class—e.g., the traveling salesman problem, satisfiability problems, and graph-covering problems.

So-called easy, or tractable, problems can be solved by computer algorithms that run in polynomial time; i.e., for a problem of size n, the time or number of steps needed to find the solution is a polynomial function of n. Algorithms for solving hard, or intractable, problems, on the other hand, require times that are exponential functions of the problem size n. Polynomial-time algorithms are considered to be efficient, while exponential-time algorithms are considered inefficient, because the execution times of the latter grow much more rapidly as the problem size increases.

NP-complete problem | Definition, Examples, & Facts (1)

Britannica Quiz

Numbers and Mathematics

A problem is called NP (nondeterministic polynomial) if its solution can be guessed and verified in polynomial time; nondeterministic means that no particular rule is followed to make the guess. If a problem is NP and all other NP problems are polynomial-time reducible to it, the problem is NP-complete. Thus, finding an efficient algorithm for any NP-complete problem implies that an efficient algorithm can be found for all such problems, since any problem belonging to this class can be recast into any other member of the class. It is not known whether any polynomial-time algorithms will ever be found for NP-complete problems, and determining whether these problems are tractable or intractable remains one of the most important questions in theoretical computer science. When an NP-complete problem must be solved, one approach is to use a polynomial algorithm to approximate the solution; the answer thus obtained will not necessarily be optimal but will be reasonably close.

The Editors of Encyclopaedia Britannica This article was most recently revised and updated by Erik Gregersen.

NP-complete problem | Definition, Examples, & Facts (2024)

FAQs

NP-complete problem | Definition, Examples, & Facts? ›

An NP Complete problem is a decision problem for which a 'yes' answer can be verified in polynomial time, but no polynomial-time algorithm has been discovered that can either provide 'yes' or 'no' answers. An NP Complete problem is a problem that can neither be solved nor verified in polynomial time.

What is an example of NP-complete language? ›

Input: φ a boolean formula in conjunctive nor- mal form with 3 literals per clause (3CNF). Question: is there a satisfying assignment? The NP-complete languages are the hardest lan- guages in NP and every language in NP poly- nomially reduces to these. Examples of NP- complete languages include SAT and HAMPATH.

What is the most famous NP-complete problem? ›

And in real life, NP-complete problems are fairly common, especially in large scheduling tasks. The most famous NP-complete problem, for instance, is the so-called traveling-salesman problem: given N cities and the distances between them, can you find a route that hits all of them but is shorter than …

What is NP-complete for dummies? ›

An NP-complete problem is an NP problem such that if one could find answers to that problem in polynomial number of steps, one could also find answers to all NP problems in polynomial number of steps.

What is an example of a NP problem which is not NP-complete? ›

The graph isomorphism problem, the discrete logarithm problem, and the integer factorization problem are examples of problems believed to be NP-intermediate. They are some of the very few NP problems not known to be in P or to be NP-complete.

What is NP-hard problems explain with examples? ›

Examples of NP-hard problems include the Traveling Salesman Problem, the Knapsack Problem, and the Integer Programming Problem. In the Traveling Salesman Problem, the goal is to find the shortest possible route that visits a given set of cities and returns to the starting city.

What makes something NP-complete? ›

A problem is called NP (nondeterministic polynomial) if its solution can be guessed and verified in polynomial time; nondeterministic means that no particular rule is followed to make the guess. If a problem is NP and all other NP problems are polynomial-time reducible to it, the problem is NP-complete.

What is meant by NP-complete? ›

NP-complete problems are a subset of the larger class of NP (nondeterministic polynomial time) problems. NP problems are a class of computational problems that can be solved in polynomial time by a non-deterministic machine and can be verified in polynomial time by a deterministic Machine.

How do you solve NP-complete? ›

NP-Completeness
  1. Use a heuristic. If you can't quickly solve the problem with a good worst case time, maybe you can come up with a method for solving a reasonable fraction of the common cases.
  2. Solve the problem approximately instead of exactly. ...
  3. Use an exponential time solution anyway. ...
  4. Choose a better abstraction.

How to determine if a problem is NP-complete? ›

We say X is NP-complete if: X ∈ NP • for all Y ∈ NP, Y ≤P X. If these hold, then X can be used to solve every problem in NP. Therefore, X is definitely at least as hard as every problem in NP.

Can NP-complete be solved? ›

(i) All NP-complete problems are solvable in polynomial time: Yes. Every problem in NP is polynomially reducible to SAT, and SAT is reducible to every NP-hard problem.

What is the importance of NP-complete problem? ›

If one can establish a problem as NP-complete, there is strong reason to believe that it is intractable. We would then do better by trying to design a good approximation algorithm rather than searching endlessly seeking an exact solution.

What is the difference between NP-complete and no hard? ›

NP-hard problems are at least as hard as any NP problem, meaning that there is no efficient algorithm that can solve them in polynomial time. NP-complete problems are a subset of NP-hard problems that are also in NP, meaning that they can be verified in polynomial time.

Why is NP-complete NP-hard? ›

We can see that NP-complete problems are the hardest problem in NP. The reason is that if A is in NP, and B is a NP-complete problem, then A can be reduced to B. Therefore, if any NP-complete problem has a polynomial time algorithm, then P = NP.

Is minesweeper NP-complete? ›

NP-Completeness

Kaye showed that the minesweeper puzzle is NP-complete by reducing instances of SAT (satisfiability of formulas of propositional logic) to instances of the puzzle. The SAT instances are given as circuits constructed of Boolean logic gates.

Is knapsack problem NP-complete? ›

Theorem 1 Knapsack is NP-complete. Proof: First of all, Knapsack is NP. The proof is the set S of items that are chosen and the verification process is to compute ∑i∈S si and ∑i∈S vi, which takes polynomial time in the size of input.

Is Battleship NP-complete? ›

Battleship is an NP-complete problem. In 1997, former contributing editor to the Battleship column in Games magazine Moshe Rubin released Fathom It!, a popular Windows implementation of Battleship.

Top Articles
Latest Posts
Article information

Author: Delena Feil

Last Updated:

Views: 5543

Rating: 4.4 / 5 (45 voted)

Reviews: 84% of readers found this page helpful

Author information

Name: Delena Feil

Birthday: 1998-08-29

Address: 747 Lubowitz Run, Sidmouth, HI 90646-5543

Phone: +99513241752844

Job: Design Supervisor

Hobby: Digital arts, Lacemaking, Air sports, Running, Scouting, Shooting, Puzzles

Introduction: My name is Delena Feil, I am a clean, splendid, calm, fancy, jolly, bright, faithful person who loves writing and wants to share my knowledge and understanding with you.