Subset sum problem: Difference between revisions
Content added Content deleted
m (→version 2: added a comment about not being a brute-force method because of short circuiting. -- ~~~~) |
m (→version 2: changed the wording slightly. -- ~~~~) |
||
Line 751: | Line 751: | ||
<br>program more bulkier, so the list was just sorted externally. |
<br>program more bulkier, so the list was just sorted externally. |
||
<br>It's faster than version 1 (above) because it takes advantage of short-circuiting the |
<br>It's faster than version 1 (above) because it takes advantage of short-circuiting the |
||
<br>summing process and because of the short-circuiting, |
<br>summing process and because of the short-circuiting, this version isn't a brute-force method. |
||
<lang rexx>/*REXX pgm finds some non-null subsets of a weighted list whose sum=0. */ |
<lang rexx>/*REXX pgm finds some non-null subsets of a weighted list whose sum=0. */ |
||
arg target stopAt . /*get arguments from command line*/ |
arg target stopAt . /*get arguments from command line*/ |