liveBook · Manning

NP-hard problem

An NP-hard problem is a computational problem to which every problem in NP can be reduced in polynomial time, whether or not the problem itself belongs to NP.

How 2 Manning books explain it

Optimization Algorithms: AI techniques for design, planning, and control problems

The class of problems at least as hard as the hardest problems in NP, whether or not they are decision problems in NP.

How it is used
Frames difficult search and optimization tasks where practical computation favors approximate or heuristic solutions.
How deep it goes
Defines NP-hardness, distinguishes neighboring complexity classes, and stops short of presenting formal reductions or proofs.
Examples
Uses traveling-salesman routing, object clustering, smart-cart collection, permutations, combinations, and Stirling numbers.
What you can do after
Evaluate whether an optimization task calls for exact, approximate, or heuristic solving.

Read how Optimization Algorithms: AI techniques for design, planning, and control problems explains NP-hard problem →

Classic Computer Science Problems in Swift: Essential techniques for practicing programmers

An NP-hard problem is a problem at least as difficult as every problem in NP under polynomial-time reductions and not known to have a polynomial-time solution.

How it is used
Frames the traveling salesman problem as a practical demonstration of rapidly growing computational difficulty.
How deep it goes
Explains the definition through a brute-force Swift implementation, but does not develop alternative optimization methods.
Examples
Uses five Vermont cities, a distance table, recursive permutations, and a 318-mile shortest cycle.
What you can do after
Build it from scratch in Swift by generating candidate cycles, measuring routes, and selecting the minimum.

Read how Classic Computer Science Problems in Swift: Essential techniques for practicing programmers explains NP-hard problem →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.