使用地图,我需要找到两个车站之间的路径。
例如,如果用户说他/她在劳伦斯,并且想去埃格林顿,则输出应该是 。"Lawrence, 100, 30, Kennedy, 19, Eglinton"
使用可用的代码(如Dijkstra算法或A *搜索算法)没有问题(这可能是我需要的最佳代码,不确定)。但我确实需要使用某种类型的数组,队列或列表。地图的这种实现是否有效?还是我必须创建一个矩阵?
String ThreeArray[][] = new String [2][7];
ThreeArray[0][0] = "140";
ThreeArray[0][1] = "134";
ThreeArray[0][2] = "Lawrence";
ThreeArray[0][3] = "100";
ThreeArray[0][4] = "30";
ThreeArray[0][5] = "Summerhill";
ThreeArray[0][6] = "Warden";
ThreeArray[0][7] = "Broadview";
ThreeArray[1][0] = "Chester";
ThreeArray[1][1] = "Kennedy";
ThreeArray[1][2] = "19";
ThreeArray[1][3] = "Eglinton";
ThreeArray[2][0] = "Donalds";
ThreeArray[2][1] = "Davisville";
ThreeArray[2][2] = "Yorkdale";
ThreeArray[2][3] = "Midland";
素胚勾勒不出你
POPMUISE
相关分类