Singular Manual: subset_sum01

| #### D.12.3.41 subset_sum01 Procedure from library `crypto.lib` (see crypto_lib). Usage: subset_sum01(knapsack,solution) Return: binary list of the positions of the elements included in the subset sum or 0 if no solution exists Note: This will return the first solution of the ssk-problem, given be the smallest binary encoding. It wont return several solutions if they exist Example:
    LIB "crypto.lib";
    list h=1,4,7,32;
    subset_sum01(h,20);
    ==> 0
    subset_sum01(h,11);
    ==> [1]:
    ==>    0
    ==> [2]:
    ==>    1
    ==> [3]:
    ==>    1
    ==> [4]:
    ==>    0
    subset_sum01(h,33);
    ==> [1]:
    ==>    1
    ==> [2]:
    ==>    0
    ==> [3]:
    ==>    0
    ==> [4]:
    ==>    1

User manual for Singular version 4-1-2p4, 2020, generated by texi2html.