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

Method DSU

CountTheNumberOfCompleteComponents.java:32–39  ·  view source on GitHub ↗
(int n)

Source from the content-addressed store, hash-verified

30 int[] size;
31
32 DSU(int n) {
33 parent = new int[n];
34 size = new int[n];
35 for(int i=0;i<n;i++){
36 parent[i] = i;
37 }
38 Arrays.fill(size, 1);
39 }
40
41 // Find root of component with path compression
42 int find(int node) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected