Subset sum problem

https://en.wikipedia.org/wiki/Subset_sum_problem

In computer science, the subset sum problem is an important problem in complexity theory and cryptography. The problem is this: given a set (or multiset) of integers, is there a non-empty subset whose sum is zero? For example, given the set {−7, −3, −2, 5, 8}, the answer is yes because the subset {−3, −2, 5} sums to zero. The problem is NP-complete.

An equivalent problem is this: given a set of integers and an integer s, does any non-empty subset sum to s? Subset sum can also be thought of as a special case of the knapsack problem.[1] One interesting special case of subset sum is the partition problem, in which s is half of the sum of all elements in the set.

原文地址:https://www.cnblogs.com/rsapaper/p/6108179.html