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
-2
votes
1 answer

Wrong result of np.dot

I'm new in python and I'm trying to do the multiplication of a 2d matrix with a 1d one. I use np.dot to do it but it gives me a wrong output. I'm trying to do this: #X_train.shape = 60000 w = np.zeros([784, 1]) lista = range (0, len(X_train)) for i…
jasmin
  • 19
  • 5
-2
votes
2 answers

Which of the following is the most precise classification of a problem X?

Which of the following is the most precise classification of a problem X? X is in NP X is in P X is in O(n2) X is in Θ(n2). I would greatly appreciate if anyone could explain the answer of this to me? I believe it's either NP or P, but i'm really…
AlanFoster
  • 8,156
  • 5
  • 35
  • 52
-2
votes
1 answer

Is the NO-VERTEX-COVER in NP or not?

This is the reverse version of vertex cover problem. Consider a decision problem that asks whether, given a graph G = (V, E) and a nonnegative integer k, there does not exist a vertex cover of size no larger than k. Answer whether this problem is NP…
Student
  • 45
  • 1
-2
votes
1 answer

If P != NP, are there more P than non-P problems or vice versa?

If P != NP, are there then more Polynomial problems than SuperPolynomial problems, or vice versa?
Albert Hendriks
  • 1,979
  • 3
  • 25
  • 45
-2
votes
1 answer

Why P=NP does not imply that halting of Turing machine solvable in polynomial time?

I read somewhere that -if some how someone someday can prove that P=NP then we cannot say that halting problem is solvable in polynomial time. Can you please explain why?
alienCoder
  • 1,461
  • 3
  • 17
  • 23
-2
votes
2 answers

Python time from a 6 digit number

I have a series of six digit numbers in this array: a = np.array((121011,121020,121025,121030,121032,121037,121234)) How do I get a time from each of the six digit numbers? e.g.: 12:10:11 I wish to use the time for calculations.
Jay
  • 291
  • 1
  • 6
  • 19
-3
votes
1 answer

Priority interval scheduling algorithm

I have the following problem. Imagine a set of jobs, with start time (st) and end time (et). Each job has a priority value. I need to schedule these jobs using a number of machines greater than 1. Basically is the same problem of the classroom…
Vap
  • 1
  • 1
-4
votes
1 answer

Minimum cost to repair road

Let us assume there is highway There are N potholes at points [p1, p2, p3...., pn] There are equal number of service crew at points [s1, s2, s3...., sn] One service crew can repair one pothole only The cost to send a crew at point pX to repair a…
Hacky Dev
  • 3
  • 1
  • 4
-4
votes
1 answer

Calculating Largest Sum from N lists of Numbers taking one element from each list

Problem Statement: I have N lists of numbers. I have to take one element from each list and cannot take more than one number from any list. Calculate the maximum sum. I think this is an NP-Hard problem. If it is indeed an NP-Hard problem, what…
-5
votes
2 answers

non-deterministic polynomial solutions over deterministic polynomial solution

Non-Deterministic Polynomial solutions are always not desirable over Deterministic Polynomial solutions is it true? Please give an appropriate reasoning.
-5
votes
1 answer

How to check whether data of a row is in list, inside of np.where()?

developed_countries = ["NOR","AUS","CHE","DEU","DNK","SGP","NLD","IRL","ISL","CAN","USA","NZL","SWE","LIE","GBR"] recent_indicators['Developed'] = np.where(recent_indicators['CountryCode'] in developed_countries, 1, 0) "ValueError: The truth…
-5
votes
1 answer

Is there any NP example that we can get an answer in polynomial time?

I just read NP and P on wikipedia, I have two questions: Can we solve an NP example in polynomial time ? Is there any NP example that we can get an answer in polynomial time?
Tracy Da
  • 325
  • 1
  • 2
  • 7
1 2 3
32
33