diff --git a/kruskalMST.java b/kruskalMST.java deleted file mode 100644 index d76e54f..0000000 --- a/kruskalMST.java +++ /dev/null @@ -1,81 +0,0 @@ -import java.util.*; -public class kruskalMST{ - static class Edge implements Comparable{ - int u,v,weight; - Edge(int u, int v, int weight){ - this.u=u; - this.v = v; - this.weight = weight; - - } - public int compareTo(Edge other){ - return this.weight-other.weight; - } - } - static int[] parent; - - static int find(int x){ - if(parent[x]!=x) - parent[x] = find(parent[x]); - return parent[x]; - } - - static void union(int x, int y){ - int rootX = find(x); - int rootY = find(y); - - parent[rootY]= rootX; - } - public static void main(String[] args){ - Scanner sc = new Scanner(System.in); - System.out.print("ENter number of vertices: "); - int N = sc.nextInt(); - - int[][] graph = new int[N][N]; - - System.out.println("\nEnter adjacency matrix(0 if no edge): "); - for(int i =0;i edges = new ArrayList<>(); - for(int i =0;i