public class Kruskal { public static void main(String[] args) { //二维数组 分别存储边的起点 终点 和权值 int [][]edges = { {0,1,6},{0,2,1},{0,3,5},{1,2,5},{1,4,3},{2,3,5},{2,4,6},{2,5,4},{3,5,2},{4,5,6}}; int []connect = {0,1,2,3,4,5};//辅助数组 用来存储两个顶点是否连通 初始都不连通 quick_sort(edges,0,edges.length-1);//对边进行排序 for(int i=0;i"+(v2+1)); for(int j=0;j = a[low][2]) low++; a[high] = a[low]; } a[low] = k; return low; }}