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

Method DSU

MinimumCostWalkInWeightedGraph.java:4–10  ·  view source on GitHub ↗
(int n)

Source from the content-addressed store, hash-verified

2 int rank[];
3 int parent[];
4 DSU(int n){
5 rank = new int[n]; //0
6 parent = new int[n];
7 for(int i=0;i<n;i++){
8 parent[i] = i;
9 }
10 }
11 public int find(int node){
12 if(node == parent[node]){
13 return node;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected