Anonymous user
Subset sum problem: Difference between revisions
→version 2: approximated the version 2 's speed vs. version 1. -- ~~~~
(→{{header|Python}}: Brute force it) |
(→version 2: approximated the version 2 's speed vs. version 1. -- ~~~~) |
||
Line 774:
<br>Code could've been included to sort the table, but the extra code would've made the
<br>program more bulkier, so the list was just sorted externally.
<br>It's about three times faster than version 1 (above) because it takes advantage of short-circuiting the
<br>summing process, this version isn't a brute-force method.
<lang rexx>/*REXX pgm finds some non-null subsets of a weighted list whose sum=0. */
|