0%

Subset Sum Problem(子集和问题)

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 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. 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.


Subset-sum Problem
The subset sum problem, is a special case of the decision and 0-1 problems where each kind of item, the weight equals the value: . In the field of cryptography, the term knapsack problem is often used to refer specifically to the subset sum problem and is commonly known as one of Karp’s 21 NP-complete problems.
The generalization of subset-sum problem is called multiple subset-sum problem, in which multiple bins exist with the same capacity. It has been shown that the generalization does not have an FPTAS.



N个数的集合,是否存在子集,它的和满足一定条件
1.子集的和等于0
2.子集和 等于N个数的和的一半(将集合分成两个相等的子集)
3.N个数为非负数
4.N个数有负数
5.N个数的大小区间 N个数最大是多少,最小是多少


分析


1.N个数为非负数时,

參考

Subset Sum Problem
subset-sum_problem
Subset_sum_problem