Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I wonder who needs to know this who doesn’t also need to know the difference between a decision (yes/no) problem and a general problem. This is relevant because P and NP are only defined for decision problems, but all of the examples given aren’t such problems.


Can't general problems be reduced to decision problems though?


All I've seen pretty much can.

Each solution can be encoded as an integer, and as long as you can construct your query as "is solution less than N?", you can use binary search to solve the problem in log(n) repetitions of the query, which does not affect the complexity class.


I am a bit rusty on this theory but isn't the N in your case related to the output size while you would need it to be related to input size instead?


Depends on the problem, really. I've been out of school for half a decade now so I'm a little rusty too.

I remember that the Traveling Salesman can be constructed as "is the minimum path less than N" in which N represents the solution, not the size.


They can always be reduced, but sometimes with an unacceptably large (e.g., non-polynomial) increase in time complexity.

These are the complexity classes of Function P (FP) and Function NP (FNP), which are the function problem extensions of the decision problem classes, and require finding the value, not just answering yes or no.

A simple example of a decision problem in P but whose search problem is not known to be in FP: For a given integer x, “does there exist a non-trivial prime factor of x?” vs. “find a non-trivial prime factor of x”.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: