Questions tagged [np]

NP ("nondeterministic polynomial") is a complexity class of decision problems that can be solved by a nondeterministic Turing machine in polynomial time. Equivalently, it is the set of decision problems for which an answer can be verified in polynomial time by a deterministic Turing machine.

NP (nondeterministic polynomial-time) is a complexity class of decision problems that can be solved by a nondeterministic Turing machine in polynomial time. Equivalently, it is the set of decision problems for which an answer can be verified in polynomial time by a deterministic Turing machine.

For example:

  • 3-Colorability: Given a graph, can each vertex be colored red, green, or blue so that no two neighboring vertices have the same color?
  • Hamiltonian Cycle: Given a graph, is there a cycle that visits each vertex exactly once?
  • Traveling Salesperson: Given a set of n cities, and the distance between each pair of cities, is there a route that visits each city exactly once before returning to the starting city, and has length at most T?
  • Maximum Clique: Given a graph, are there k vertices all of which are neighbors of each other?
  • Subset Sum: Given a collection of integers, is there a subset of the integers that sums to exactly

References

492 questions
0
votes
0 answers

Problems formerly in NP but now in P

Are there any problems that used to be in NP (not NP-complete and not P) but since then have been proven to be in P? I saw this video which states that people sometimes find ways of doing NP problems as quickly as P, thus proving that the problem is…
0
votes
1 answer

Why do we say that NP complete problems are NP?

I have gone through all the links regarding this topic but still confused that why do we consider NP Complete to be NP. Is it only that we can verify it in polynomial time that we say that NP complete problems are NP, but we have some NP problems…
radhika
  • 41
  • 2
0
votes
1 answer

Non-exhaustive worst-case NP-complete solving algorithm

Disclamer: First of all, I know that not all NP-complete problems have a large 'search space' where they have to look for a solution, but a large amount of the best-known ones do, so I will make this assumption since this is a question about (known)…
Goens
  • 407
  • 3
  • 11
0
votes
4 answers

How to prove a prob is np complete and is in np?

Given a department needs a committee to select the department’s head. The committee cannot include people who have conflicts of interest with each other. The input consists of: the desired committee size a list of all people a list of all pairs of…
0
votes
1 answer

Efficiently assign games

I am looking to solve a problem and would appreciate if someone can point me to algorithm that i can study to implement. The problem is that we as a store are offering Game bundles. A bundle can have multiple games i.e. B1 = {G1, G2, G3}, B2 =…
Em Ae
  • 8,167
  • 27
  • 95
  • 162
0
votes
1 answer

If algorithm in P, efficient way to extract solutions?

Maybe this is very obvious, but if we had an algorithm in P (so this algorithm gives a yes/no answer in polynomial time), is there a more efficient way to find the solution beyond just guessing and checking? So, suppose SAT is in P (I know this is…
lalaloooo
  • 15
  • 3
0
votes
4 answers

Given an undirected graph G = (V, E), determine whether G is a complete graph

I'm pretty sure this problem is P and not NP, but I'm having difficulty coming up with a polynomially bound algorithm to solve it.
user3316874
  • 223
  • 2
  • 6
  • 10
0
votes
1 answer

Is finding whether k different perfect matchings exist in a bipartite graph co-NP?

Few definitions first. The co-NP problem is a decision problem where the answer "NO" can be verified in polynomial time. The perfect matching in a bipartite graph is a set of pairs of nodes (a pair is an edge in the graph) and where every node…
Traveling Salesman
  • 2,209
  • 11
  • 46
  • 83
0
votes
1 answer

Minimum Set Cover Algorithm: Finding Size of Optimal Cover

The Set-Cover Problem consists of the following: Given: A set of Items U. A set of Sets S each of which contain items from U. Find the set of sets C such that: C is a subset of S. The sets in C contains all items in U. (at least…
JD009
  • 49
  • 7
0
votes
1 answer

How to show that a prob is in NP and that it is NP-complete

Longest Path We have a graph G=(V,E), lengths l(e) in Z^(+) for each e in E, a positive integer K and two nodes s,t in V. The question is if there is a simple path in G from s to t of length at least K ? Show that the problem Longest Path belongs…
Mary Star
  • 375
  • 7
  • 27
0
votes
2 answers

Complexity of Some problems in NP?

I want to summarize some problem on Complexity. Which of them can be solved in poly-time? I) finding maximal sub complete graph of given graph = Clique Problem II) select some elements among n objects in which value and weights are given, such…
user4672610
0
votes
1 answer

Array search NP complete

Given an unsorted array of size n, it's obvious that finding whether an element exists in the array takes O(n) time. If we let m = log n then it takes O(2^m) time. Notice that if the array is sorted, a binary search actually takes O(m) time (which…
0
votes
1 answer

Does every NP-complete prob. admit a polynomial-time restriction?

I have to answer this question as a homework assignment but I am finding very little material to work with. I understand what is a NP-complete problem and what is a restriction. In my opinion, this statement is true, because you can always restrict…
Cleverson
  • 5
  • 4
0
votes
1 answer

Concatenation of two languages in NP

I have a hard time to understand why the concatenation of two languages over an alphabet, which is in NP, doesn't imply that each of the languages for themselves are in NP. I talked with my Prof about the problem today, but I can't wrap my head…
0
votes
0 answers

Time complexity for hamiltonian path

below is the code to find if a Hamiltonian path exist in a graph using backtracking. And as per the code below time complexity comes out to be O(V^2), where V is total number to vertices. But Hamiltonian problem is NP-Complete. which as per my…