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

Method findRootParent

RedundantConnection.java:29–35  ·  view source on GitHub ↗
(int node)

Source from the content-addressed store, hash-verified

27 }
28
29 public int findRootParent(int node){
30 if(node == parent[node]){
31 return node;
32 }
33 parent[node] = findRootParent(parent[node]);
34 return parent[node];
35 }
36 public boolean unionBySize(int node1, int node2){
37 //1. find the root parent
38 int rootParent1 = findRootParent(node1);

Callers 1

unionBySizeMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected