Problem complexity & NP-completeness
Reading time10 minIn brief
Article summary
Until now, we have studied the complexity of agorithms, as ways to estimate the required time needed to complete, as a function of its inputs. More generally, problems have a notion of complexity. This means that for a given problem, we cannot find an algorithm with better complexity to solve that problem.
Main takeaways
-
There are classes of complexities for problems.
-
The complexity of a problem describes the minimum complexity of an algorithm solving it.
-
There are intersections, inclusion relations, or equivalences between some classes of complexity.
-
Complexity can also describe the required memory to solve a problem.
Article contents
1 — Video
Please check the video below. You can also read the transcripts if you prefer.
To go further
2 — Complexity in space
The classes of complexity above describe the time requirements to solve problems. In order to measure other requirements, such as memory consumption, there exist other classes of complexity.
Similar to time complexity, space complexity measures the smallest amount of memory a program would need to solve the problem in consideration, for the worst-case input. Again, it can be seen as a “minimum of maximum”.
We also use big-O notations to describe the memory usage, as a function of the input size. As examples, $O(n)$ denotes linear memory usage, and $O(n!)$ indicates solving the problem requires at least a quantity of memory that grows factorially with the dimension of the input.
As for time complexity classes, there is a huge taxonomy of space complexity classes.
Among the classic ones, PSPACE indicates that a problem cannot be solved with less than a polynomial amount of memory.
Space and time complexities are not unrelated. As an example, it is shown that NP $\subseteq$ PSPACE. Still, there are numerous equalities between classes that are unknown, many of which have been open problems in research for decades.
To go beyond
-
A taxonomy of complexity classes of functions.
-
The problem of determining if P and NP are the same is a major problem in computer science.