HN Debrief

NP-Overrated

  • Programming
  • Algorithms
  • Developer Tools
  • Security
  • Infrastructure

The post says developers are often taught the wrong lesson from NP-hardness. The useful lesson is not "don't touch these problems". It is that many real systems succeed because their inputs have exploitable structure, because they solve special cases, or because a near-best answer is fine. That framing landed with most people. Nobody disputed that SAT solvers, routing systems, package resolvers, and operations research tools routinely do impressive work on theoretically hard problems.

Treat an NP-hard label as a design constraint, not a stop sign. In products and infrastructure, the winning move is usually to restrict the input space, pick acceptable approximation bounds, and harden the system against the few cases that still explode.

Discussion mood

Mostly positive on the post's core practical message, but impatient with its imprecision. People liked the reminder that NP-hard does not mean useless in practice, while insisting that exact optimality, worst-case guarantees, and the difference between theory and product design still matter a lot.

Key insights

  1. 01

    Package managers escape hardness by design

    Dependency resolution works in practice because ecosystems deliberately remove the conditions that make the full problem nasty. NPM and Yarn allow multiple versions, Go uses minimum version selection, and Cargo narrows the hard cases enough that heuristics mop up the rest. That is not a workaround after the fact. The package manager's rules are the algorithmic strategy.

    When your product sits on top of a hard search problem, make the user-facing model less expressive before you optimize the solver. The biggest speedup often comes from forbidding troublesome cases, not from a smarter backend.

      Attribution:
    • Guvante #1
    • porridgeraisin #1
    • ryangibb #1
    • silasdavis #1
    • singpolyma3 #1
    • Bratmon #1
  2. 02

    Adversarial inputs are where theory bites

    Heuristics shine on everyday instances, but some domains are built around manufacturing worst cases. Cryptography intentionally creates search spaces that SAT-style tricks cannot cheaply cut through, and backtracking regex engines can turn that same gap between normal and pathological behavior into a denial of service vector. The important distinction is not "hard in theory" versus "easy in practice". It is whether users or attackers can force the bad instances.

    Audit any solver-like component that accepts outside input for crafted worst cases. Add timeouts, safer engines, or restricted grammars anywhere an attacker can steer you into exponential behavior.

      Attribution:
    • andrewla #1
    • GuB-42 #1
    • chr15m #1 #2
    • maleldil #1
  3. 03

    NP-completeness is a prioritization tool

    The strongest correction was that NP-hardness does not tell you to give up. It tells you where not to waste effort. Garey and Johnson's old framing still holds up. Once you know the general problem is NP-complete, you stop chasing a universally fast exact algorithm and redirect toward special cases, heuristics, approximations, and practical bounds. Even the post author conceded the article needed hedging on claims about optimality.

    Use complexity results early in roadmap planning. If the general problem is known hard, scope research toward restricted instances and operational thresholds instead of betting the schedule on a breakthrough algorithm.

      Attribution:
    • sfink #1
    • ngruhn #1
    • tzs #1
  4. 04

    Operations research already solved this culture gap

    Several people pointed out that operations research has spent decades turning NP-hard problems into working systems with branch-and-bound, mixed-integer programming, approximation algorithms, and domain heuristics. That is why million-variable integer programs can sometimes solve shockingly fast, and also why practitioners care about bounds and approximation ratios instead of pretending exactness always survives. Computer science education often underexposes this toolbox.

    If your team faces scheduling, routing, allocation, or planning problems, look at operations research methods before building custom heuristics from scratch. You may be reinventing a mature stack with much better guarantees and tooling.

      Attribution:
    • LPisGood #1
    • cschmidt #1
    • lennoff #1
    • hingler36 #1
    • hyperpape #1
    • not2b #1
  5. 05

    Big-O labels miss practical bottlenecks

    Real performance failures cut both ways. Swift type inference shows how an expressive feature can trigger exponential pain that users feel directly. At the same time, cubic algorithms can be unusable on very large inputs, and simplex keeps winning despite exponential worst-case bounds because actual workloads and implementations favor it. The useful question is not just which class a problem belongs to. It is what sizes, structures, and machine behaviors dominate your deployment.

    Benchmark on real instance distributions and scale targets before you choose an algorithmic direction. Worst-case class, approximation guarantee, and memory behavior all need to be judged against the actual workload, not in isolation.

      Attribution:
    • not2b #1
    • murderfs #1
    • bschoepke #1
    • maleldil #1
    • oinoom #1
    • joe_the_user #1
    • whatever1 #1

Against the grain

  1. 01

    Package resolution still hurts in the wild

    Aptitude on long-lived Debian systems is a reminder that some "practical" NP-hard problems remain painful when the product keeps the expressive, user-friendly version of the problem. Downgrades, removals, and recommendation choices create a huge search space that users sometimes have to prune manually. Newer apt can hand this to a SAT-based solver, but the complaint stands that not every ecosystem has engineered the hard part away equally well.

    Do not assume a familiar domain has already neutralized its hard cases. Check the actual solver design and failure modes in the specific toolchain your users depend on.

      Attribution:
    • tux3 #1
    • AlotOfReading #1
  2. 02

    Some hard problems are harder than NP

    The post focused on NP-hardness as the emblem of computational difficulty, but that can understate the landscape. Practical systems can hit problems that are PSPACE-hard or otherwise beyond the usual NP-complete canon, and SAT's success does not automatically transfer to those cases. The theory is broader than the blog's framing.

    If you rely on complexity arguments, verify you are naming the right class. "Not Turing-complete" or "not NP-hard" does not imply easy analysis.

      Attribution:
    • pron #1

In plain english

Branch-and-bound
An exact optimization technique that systematically searches possibilities while pruning regions that cannot beat the current best answer.
Denial of service
An attack that makes a system unavailable by forcing it to spend excessive time or resources on malicious input.
Mixed-integer optimization
An optimization method where some decision variables must take whole-number values and others may be continuous, widely used in planning and logistics.
NP-complete
Problems that are both in NP and NP-hard, often used as the standard benchmark for intractable exact computation.
NP-hard
A class of problems at least as hard as the hardest problems in NP, meaning no polynomial-time algorithm is known for solving all cases exactly.
O(n^3)
A cubic-time growth rate where runtime increases roughly with the cube of input size.
Operations research
A field focused on mathematical methods for optimizing decisions in areas like routing, scheduling, and resource allocation.
P
The class of problems that can be solved in polynomial time, which is often treated as a rough notion of efficiently solvable.
PSPACE-hard
At least as hard as the hardest problems solvable with polynomial memory, which is generally believed to be harder than NP-complete.
SAT
Boolean satisfiability, the problem of deciding whether there exists an assignment of true or false values that makes a logical formula true.
Type inference
A compiler technique that automatically figures out the types of expressions without explicit type annotations.

Reference links

Complexity theory references

Package solver implementation

Cryptography papers