MCPcopy Create free account
hub / github.com/Tiwarishashwat/InterviewCodes / DisjointSet

Method DisjointSet

KruskalsAlgorithm.java:35–42  ·  view source on GitHub ↗
(int nodes)

Source from the content-addressed store, hash-verified

33 int parent[];
34 int size[];
35 DisjointSet(int nodes){
36 this.parent = new int[nodes];
37 this.size = new int[nodes];
38 for(int i=0;i<nodes;i++){
39 this.parent[i] = i;
40 this.size[i] = 1;
41 }
42 }
43
44 public int findRootParent(int node){
45 if(node == parent[node]){

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected