Transportation problem: Difference between revisions
Content added Content deleted
(→{{header|Java}}: added some comments) |
m (Added to the D versions some comments from the Java version.) |
||
Line 591: | Line 591: | ||
Shipment[] stones = chain([s], matrixToSeq(matrix)).array; |
Shipment[] stones = chain([s], matrixToSeq(matrix)).array; |
||
// Remove (and keep removing) elements that do not have |
|||
// a vertical AND horizontal neighbor. |
|||
while (true) { |
while (true) { |
||
auto stones2 = stones.remove!((in e) { |
auto stones2 = stones.remove!((in e) { |
||
Line 602: | Line 604: | ||
} |
} |
||
// Place the remaining elements in the correct plus-minus order. |
|||
auto stones3 = stones.dup; |
auto stones3 = stones.dup; |
||
Shipment prev = s; |
Shipment prev = s; |