Knapsack problem
The knapsack problem isproblemcomplexity theory, cryptography,applied mathematics. Givensetitems, each withcost andvalue, determinenumbereach iteminclude incollection so thattotal costless than some given cost andtotal valueas large as possible. The name derives fromscenariochoosing treasuresstuff into your knapsack, when you can only carry so much weight.The decision problem form ofknapsack problem isquestion "canvalueat least V be achieved without exceedingcost C?"
The 0/1 knapsack problem restrictsnumbereach itemszero or one.
Of particular interest isspecial case ofproblemthese properties:
- It isdecision problem
- It is0/1 problem
- For each item,cost equalsvalue
- C = V
The knapsack problemoften solved using dynamic programming, though no polynomial-time algorithmknown forgeneral problem. Bothgeneral knapsack problem andsubset sum problemNP-hard,this has ledattemptsuse subset sum asbasispublic key cryptography systems, such as Merkle-Hellman. These attempts typically used some group other thanintegers. Merkle-Hellmanseveral similar algorithms were later broken, becausesubset sum problemsproduced werefact solvable by polynomial-time algorithms.
