Questions tagged [np-complete]

Questions about the hardest problems in NP, i.e. of those that can be solved in polynomial time by nondeterministic Turing machines.

The hardest problems in NP, i.e. of those that can be solved in polynomial time by nondeterministic Turing machines.

NP-complete problems have two properties:

  1. They are in the NP complexity class (can be solved by nondeterministic Turing-machine)
  2. They are NP-hard (there is a reduction from any other NP problem to them)

A polynomial-time solution for any specific NP-complete problem will settle the $P=NP$ question affirmatively: any other problem in NP can be reduced to the specific problem of which a solution exists, and thus be solved.

Related tags

1681 questions
69
votes
3 answers

Knapsack problem -- NP-complete despite dynamic programming solution?

Knapsack problems are easily solved by dynamic programming. Dynamic programming runs in polynomial time; that is why we do it, right? I have read it is actually an NP-complete problem, though, which would mean that solving the problem in polynomial…
Strin
  • 1,515
  • 1
  • 11
  • 16
67
votes
2 answers

Are there subexponential-time algorithms for NP-complete problems?

Are there NP-complete problems which have proven subexponential-time algorithms? I am asking for the general case inputs, I am not talking about tractable special cases here. By sub-exponential, I mean an order of growth above polynomials, but…
ksb
  • 801
  • 1
  • 7
  • 5
67
votes
7 answers

Is legislation NP-complete?

I would like to know if there has been any work relating legal code to complexity. In particular, suppose we have the decision problem "Given this law book and this particular set of circumstances, is the defendant guilty?" What complexity class…
54
votes
6 answers

Why are some games np-complete?

I read the Wikipedia entry about "List of NP-complete problems" and found that games like super mario, pokemon, tetris or candy crush saga are np-complete. How can I imagine np-completeness of a game? Answers don't need to be too precise. I just…
racc44
  • 667
  • 2
  • 7
  • 11
52
votes
6 answers

Dealing with intractability: NP-complete problems

Assume that I am a programmer and I have an NP-complete problem that I need to solve it. What methods are available to deal with NPC problems? Is there a survey or something similar on this topic?
47
votes
4 answers

Are there NP problems, not in P and not NP Complete?

Are there any known problems in $\mathsf{NP}$ (and not in $\mathsf{P}$) that aren't $\mathsf{NP}$ Complete? My understanding is that there are no currently known problems where this is the case, but it hasn't been ruled out as a possibility. If…
vpiTriumph
  • 593
  • 1
  • 4
  • 7
41
votes
2 answers

How do I construct reductions between problems to prove a problem is NP-complete?

I am taking a complexity course and I am having trouble with coming up with reductions between NPC problems. How can I find reductions between problems? Is there a general trick that I can use? How should I approach a problem that asks me to prove a…
39
votes
5 answers

How can I verify a solution to Travelling Salesman Problem in polynomial time?

So, TSP (Travelling salesman problem) decision problem is NP complete. But I do not understand how I can verify that a given solution to TSP is in fact optimal in polynomial time, given that there is no way to find the optimal solution in polynomial…
Lazer
  • 1,107
  • 2
  • 10
  • 8
32
votes
6 answers

"NP-complete" optimization problems

I am slightly confused by some terminology I have encountered regarding the complexity of optimization problems. In an algorithms class, I had the large parsimony problem described as NP-complete. However, I am not exactly sure what the term…
Aniket Schneider
  • 423
  • 1
  • 4
  • 5
32
votes
3 answers

Teaching NP-completeness - Turing reductions vs Karp reductions

I'm interested in the question of how best to teach NP-completeness to computer science majors. In particular, should we teach it using Karp reductions or using Turing reductions? I feel that the concepts of NP-completeness and reductions are…
D.W.
  • 167,959
  • 22
  • 232
  • 500
31
votes
1 answer

Is regex golf NP-Complete?

As seen in this recent XKCD strip and this recent blog post from Peter Norvig (and a Slashdot story featuring the latter), "regex golf" (which might better be called the regular expression separation problem) is the puzzle of defining the shortest…
30
votes
5 answers

How can I reduce Subset Sum to Partition?

Maybe this is quite simple but I have some trouble to get this reduction. I want to reduce Subset Sum to Partition but at this time I don't see the relation! Is it possible to reduce this problem using a Levin Reduction ? If you don't understand…
dbonadiman
  • 517
  • 1
  • 4
  • 9
30
votes
1 answer

Graph problem known to be $NP$-complete only under Cook reduction

The theory of NP-completeness was initially built on Cook (polynomial-time Turing) reductions. Later, Karp introduced polynomial-time many-to-one reductions. A Cook reduction is more powerful than a Karp reduction since there is no restriction on…
Mohammad Al-Turkistany
  • 4,477
  • 1
  • 28
  • 37
29
votes
1 answer

Is the k-clique problem NP-complete?

In this Wikipedia article about the Clique problem in graph theory it states in the beginning that the problem of finding a clique of size K, in a graph G is NP-complete: Cliques have also been studied in computer science: finding whether there is…
Eivind
29
votes
2 answers

Longest Repeated (Scattered) Subsequence in a String

Informal Problem Statement: Given a string, e.g. $ACCABBAB$, we want to colour some letters red and some letters blue (and some not at all), such that reading only the red letters from left to right yields the same result as reading only the blue…
1
2 3
99 100