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

Method findRootParent

KruskalsAlgorithm.java:44–50  ·  view source on GitHub ↗
(int node)

Source from the content-addressed store, hash-verified

42 }
43
44 public int findRootParent(int node){
45 if(node == parent[node]){
46 return node;
47 }
48 parent[node] = findRootParent(parent[node]);
49 return parent[node];
50 }
51 public boolean unionBySize(int node1, int node2){
52 //1. find the root parent
53 int rootParent1 = findRootParent(node1);

Callers 1

unionBySizeMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected