Anonymous user
Transportation problem: Difference between revisions
→{{header|Java}}: added some comments
(+ D entry) |
(→{{header|Java}}: added some comments) |
||
Line 1,327:
path.addFirst(s);
// remove (and keep removing) elements that do not have a
// vertical AND horizontal neighbor
while (path.removeIf(e -> {
Shipment[] nbrs = getNeighbors(e, path);
Line 1,332 ⟶ 1,334:
}));
// place the remaining elements in the correct plus-minus order
Shipment[] stones = path.toArray(new Shipment[path.size()]);
Shipment prev = s;
|