SmallestNode1
(int numhnodes)
| 1488 | * |
| 1489 | */ |
| 1490 | private static int SmallestNode1(int numhnodes) { |
| 1491 | |
| 1492 | int best = 99999999; |
| 1493 | int bestnode = -1; |
| 1494 | for (int i = 0; i < numhnodes; i++) { |
| 1495 | if (cin.h_used[i] != 0) |
| 1496 | continue; |
| 1497 | if (cin.h_count[i] == 0) |
| 1498 | continue; |
| 1499 | if (cin.h_count[i] < best) { |
| 1500 | best = cin.h_count[i]; |
| 1501 | bestnode = i; |
| 1502 | } |
| 1503 | } |
| 1504 | |
| 1505 | if (bestnode == -1) |
| 1506 | return -1; |
| 1507 | |
| 1508 | cin.h_used[bestnode] = 1; // true |
| 1509 | return bestnode; |
| 1510 | } |
| 1511 | |
| 1512 | |
| 1513 | /** |