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

Method DisjointSet

RedundantConnection.java:20–27  ·  view source on GitHub ↗
(int nodes)

Source from the content-addressed store, hash-verified

18 int parent[];
19 int size[];
20 DisjointSet(int nodes){
21 this.parent = new int[nodes];
22 this.size = new int[nodes];
23 for(int i=0;i<nodes;i++){
24 this.parent[i] = i;
25 this.size[i] = 1;
26 }
27 }
28
29 public int findRootParent(int node){
30 if(node == parent[node]){

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected