Top
Back: subset_sum01
Forward: unbounded_knapsack
FastBack:
FastForward:
Up: crypto_lib
Top: Singular Manual
Contents: Table of Contents
Index: Index
About: About this document

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


Top Back: subset_sum01 Forward: unbounded_knapsack FastBack: FastForward: Up: crypto_lib Top: Singular Manual Contents: Table of Contents Index: Index About: About this document
            User manual for Singular version 4-0-3, 2016, generated by texi2html.