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

Strictly speaking, the fundamental complexity classes (in order: L, NL, P, NP, PSPACE, EXPTIME, NEXPTIME, EXPSPACE) apply only to decision problems, which pose yes/no questions. For example, it's commonly said that the Traveling Salesman Problem is NP-complete, but this only applies to the decision version of the problem: "Given graph G with edges weighted with positive integers and a maximum weight n, does there exist a Hamiltonian cycle through the vertices such that the sum of the weights of the edges used is at most n?" In addition, for a problem to be in NP, the polynomial-time-verifiable certificate only has to exist for yes instances, there is no need for it to also be verifiable that no such cycle exists (a problem verifiable in polynomial time for the no cases is in co-NP).

Decision problems are much easier to reason about, which is why they are used to construct and define the fundamental complexity classes, though it is certainly possible to define analogous classes for different types of problems. See for example, Krentel (1988) "The complexity of optimization problems", which considers TSP-OPT: https://doi.org/10.1016/0022-0000(88)90039-6



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

Search: