Subset sum problem: Difference between revisions
Content deleted Content added
→{{header|REXX}}: added a 2nd version of the REXX program that is faster. -- ~~~~ |
m →version 2: added a comment about not being a brute-force method because of short circuiting. -- ~~~~ |
||
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. |
<br>summing process and because of the short-circuiting, it 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*/ |