-4
异常线程“main” java.lang.ArrayIndexOutOfBoundsException
for (int i = 0; i < size; i++) { for (int j = i; j < size; j++) {
distances[i][j] = haversin(coords[i][0], coords[j][0], coords[i][1],
coords[j][1]); distances[j][i] = distances[i][j]; } } long start =
System.nanoTime(); int[] shortestPath = nearestNeighbour(distances); double
bestShort = 0; for (int i = 0; i < size; ++i) {bestShort +=
distances[shortestPath[i] - 1][shortestPath[i + 1] - 1]; } bestShort +=
distances[shortestPath[size - 1]][shortestPath[0]];
}
plz发布代码不是图像,仍然与之前的问题相同。没有改进 –
for(int i = 0; i
sha83
不要将您的代码置于评论中。把它放在问题上。 – khelwood