In
computational complexity
In computer science, the computational complexity or simply complexity of an algorithm is the amount of resources required to run it. Particular focus is given to computation time (generally measured by the number of needed elementary operations) ...
, an
NP-complete (or
NP-hard
In computational complexity theory, NP-hardness ( non-deterministic polynomial-time hardness) is the defining property of a class of problems that are informally "at least as hard as the hardest problems in NP". A simple example of an NP-hard pr ...
) problem is weakly NP-complete (or weakly NP-hard) if there is an
algorithm for the problem whose running time is
polynomial in the dimension of the problem and the magnitudes of the data involved (provided these are given as
integers), rather than the base-two
logarithms of their magnitudes. Such algorithms are technically
exponential functions of their input size and are therefore not considered
polynomial.
For example, the NP-hard
knapsack problem can be solved by a
dynamic programming algorithm requiring a number of steps polynomial in the size of the knapsack and the number of items (assuming that all data are scaled to be integers); however, the runtime of this algorithm is
exponential time since the input sizes of the objects and knapsack are logarithmic in their magnitudes. However, as Garey and Johnson (1979) observed, “A
pseudo-polynomial-time algorithm … will display 'exponential behavior' only when confronted with instances containing 'exponentially large' numbers,
hichmight be rare for the application we are interested in. If so, this type of algorithm might serve our purposes almost as well as a polynomial time algorithm.” Another example for a weakly NP-complete problem is the
subset sum problem.
The related term
strongly NP-complete In computational complexity, strong NP-completeness is a property of computational problems that is a special case of NP-completeness. A general computational problem may have numerical parameters. For example, the input to the bin packing problem ...
(or unary NP-complete) refers to those problems that remain NP-complete even if the data are encoded in
unary, that is, if the data are "small" relative to the overall input size.
[L. Hall]
Computational Complexity
The Johns Hopkins University.
References
{{Reflist
Computational complexity theory
Complexity classes