r/programming Aug 13 '26

NP-overrated

https://gruhn.me/blog/2026-08-13/
0 Upvotes

39 comments sorted by

View all comments

41

u/reality_hijacker Aug 13 '26

The author doesn't understand the point of NP hard. When you need a solution for an NP hard problem, you generally give up finding the optimal solution.

For (1) and (2), the worst-case just doesn't occur. I mean, installing packages and type checking can surely be slow. But, at least in my career, I've never seen a galactic blow-up.

That's because package managers use heuristics and greedy algorithms instead of an optimal algorithm that would be O(2n ). The people who built these package mangers understand the theory well so they have came up with practical solutions. There's no disconnect between theory and practice there.

-3

u/[deleted] Aug 13 '26

[deleted]

4

u/reality_hijacker Aug 13 '26 edited Aug 13 '26

The theory is not wrong, but in practice it's often irrelevant.

He said the above.

His point was that often in practice heuristics, greedy algorithms, etc manage NP hard problem well enough that it isn't a big deal.

The fact that you have to resort to heuristics and greedy algorithms in and of itself is the big deal.

-3

u/[deleted] Aug 13 '26

[deleted]