P=NP Explained: A Layman's Guide

  • Thread starter Thread starter DR13
  • Start date Start date
  • Tags Tags
    Explanation
AI Thread Summary
The P=NP problem is a fundamental question in computer science regarding the relationship between two classes of problems: P (problems solvable in polynomial time) and NP (problems for which a solution can be verified in polynomial time). While some problems, like sorting a list, are computationally simple and can be solved efficiently, others, such as the traveling salesman problem and the Hamiltonian cycle problem, are significantly more complex. The traveling salesman problem grows factorially with the number of cities, making brute-force solutions impractical. The Hamiltonian cycle problem, while simpler, is still NP-complete, meaning that if a polynomial-time algorithm is discovered for it, similar algorithms could be applied to all NP problems. Currently, no polynomial-time solutions exist for NP-complete problems, leading to the ongoing debate about whether P equals NP. Most computer scientists lean towards the belief that a polynomial-time solution for these hard problems does not exist, indicating that they are inherently difficult to solve.
DR13
Messages
150
Reaction score
0
Yesterday, my computer science teacher (intro course) mentioned this mythical P=NP problem. He tried to explain it to the class but it went over everyone's head. Could someone please explain it to me in laymen's terms?
Thanks
 
Technology news on Phys.org
Different problems have different computational complexity. Testing whether a list is sorted is an O(n) problem. Walk through the list, comparing the value at the current node to the value at the previous node. If the list has N elements one must perform N-1 comparisons to determine of the list is sorted. Sorting a list is O(n log n). Multiplying two square matrices is O(n2), but finding the inverse of a matrix is O(n3). In a sense, all of these problems are computationally simple. The time needed to solve the problem is polynomial in the size of the problem.

Some problems appear to be very hard to solve, much harder to solve than the polynomial-time problems described above. The traveling salesman problem is the prototypical example of these hard-to-solve problems. The number of possible routes grows factorially as the number of cities increases. A brute-force approach is nigh impossible for anything but a handful of cities. As far as we know there does not exist a polynomial-time algorithm to solve the traveling salesman problem. The hamiltonian cycle problem is somewhat simpler problem than the traveling salesman problem. The hamiltonian cycle problem just requires coming up with a valid route, but not necessarily the shortest route. However, the hamiltonian cycle problem is, as far as we know, an O(n!) problem.

Finding a solution to a given problem is often "harder" than testing whether a proposed solution is indeed a solution. Sorting a list is O(n log n) but testing whether a list is sorted is O(n). Inverting a matrix is O(n3) but testing whether a candidate solution is the inverse is O(n2). As far as we know, finding a hamiltonian cycle is O(n!) but testing whether a candidate route is valid is just O(n).

Note that verifying whether candidate solution to the hamiltonian cycle problem is a valid solution is a polynomial-time problem. The class of problems in which verifying whether a candidate solution requires polynomial time complexity is the NP class of problems. Some of these problems are known to be "easy" to solve. These are the P class of problems. P is definitely a subset of NP, but whether it is a proper subset is the P=NP problem.

The hamiltonian cycle problem is in a special subset of NP called NP-complete. If a polynomial time algorithm can be found to solve anyone of these NP-complete problems then a polynomial time algorithm exists for all NP problems. Finding such an algorithm would prove that P=NP. That nobody has found such an algorithm does not prove that P≠NP. It only shows that we haven't found the magical algorithm yet.

Or, just maybe that magical algorithm doesn't exist. That is what most computer scientists think is the case. These hard-to-solve problems are hard to solve, period.
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I had a Microsoft Technical interview this past Friday, the question I was asked was this : How do you find the middle value for a dataset that is too big to fit in RAM? I was not able to figure this out during the interview, but I have been look in this all weekend and I read something online that said it can be done at O(N) using something called the counting sort histogram algorithm ( I did not learn that in my advanced data structures and algorithms class). I have watched some youtube...
Back
Top