Knapsack problem/Unbounded: Difference between revisions
Content added Content deleted
m (→{{header|Phix}}: show all four solns, added syntax colouring, marked p2js compatible) |
m (→{{header|Tcl}}: code) |
||
Line 3,879: | Line 3,879: | ||
=={{header|Tcl}}== |
=={{header|Tcl}}== |
||
The following code uses brute force, but that's tolerable as long as it takes just a split second to find all 4 solutions. The use of arrays makes the |
The following code uses brute force, but that's tolerable as long as it takes just a split second to find all 4 solutions. The use of arrays makes the code quite legible: |
||
<lang Tcl>#!/usr/bin/env tclsh |
<lang Tcl>#!/usr/bin/env tclsh |
||
proc main argv { |
proc main argv { |