|
D.12.2.44 subset_sum02
Procedure from library crypto.lib (see crypto_lib).
- Usage:
- subset_sum02(knapsack,sol)
- Return:
- binary list of the positions of the elements included in the subset sum or 0 if no solution exists
Example:
| LIB "crypto.lib";
list h=1,4,7,32;
subset_sum02(h,20);
==> 0
subset_sum02(h,11);
==> [1]:
==> 0
==> [2]:
==> 1
==> [3]:
==> 1
==> [4]:
==> 0
subset_sum02(h,33);
==> [1]:
==> 1
==> [2]:
==> 0
==> [3]:
==> 0
==> [4]:
==> 1
|
|