r/computerscience • u/NeighborhoodFatCat • Oct 24 '25
Discussion How do you practically think about computational complexity theory?
Computational complexity (in the sense of NP-completeness, hardness, P, PPAD, so and so forth) seems to be quite very difficult to appreciate in real-life the more that you think about it.
On the one hand, it says that a class of problems that is "hard" do not have an efficient algorithm to solve them.
Here, the meaning of "hard" is not so clear to me (what's efficiency? who/what is solving them?) Also, the "time" in terms of polynomial-time is not measured in real-world clock-time, which the average person can appreciate.
On the other hand, for specific cases of the problem, we can solve them quite easily.
For example, traveling salesman problem where there is only two towns. BAM. NP-hard? Solved. Two-player matrix games are PPAD-complete and "hard", but you can hand-solve some of them in mere seconds. A lot of real-world problem are quite low dimensional and are solved easily.
So "hard" doesn't mean "cannot be solved", so what does it mean exactly?
How do you actually interpret the meaning of hardness/completeness/etc. in a real-world practical sense?
View all comments
Show parent comment
1
u/apnorton Devops Engineer | Post-quantum crypto grad student Oct 24 '25
Not really sure what you mean by "updates once." To clarify a bit, it means it takes exponentially many "basic operations" (for some reasonable definition of "basic operation") to solve the problem instance.
Not necessarily, though generally speaking wall clock time is roughly proportional to the number of "basic operations" that a program takes to perform. There are edge cases, but it is generally the case that an O(n2 ) algorithm will be faster than an O(2n ) algorithm.
Sort-of? It means that the best solution you can come up with to a problem will take, in the worst case, more than polynomially many steps to solve. ("More than polynomially many steps" isn't the easiest thing to reason about, so it's reasonable to think of this as the same as "exponentially many," but there are "sub-exponential" runtimes that are out there.)
To explain why there's the "in the worst case," consider a solver for the decision TSP that consists of two steps in a loop: 1) produce a yet-unseen path, 2) if the path has length less than the target length, return true.
In the "best case," this approach exists immediately, but it's still exponentially slow in the worst case.
These optimizations merely adjust the constant factors that get elided by asymptotic analysis, so they do get ignored, yes. They don't fundamentally change what class a problem is in.
Quantum is different, and there's a whole field of quantum complexity theory.