MCPcopy Create free account
hub / github.com/algorithmzuo/algorithm-journey / link

Method link

src/class191/Code06_Network1.java:129–142  ·  view source on GitHub ↗
(int x, int y)

Source from the content-addressed store, hash-verified

127 }
128
129 public static void link(int x, int y) {
130 x = find(belong[x]);
131 y = find(belong[y]);
132 while (x != y) {
133 if (dep[x] >= dep[y]) {
134 union(x, up[x]);
135 x = find(x);
136 } else {
137 union(y, up[y]);
138 y = find(y);
139 }
140 ebccCnt--;
141 }
142 }
143
144 public static void main(String[] args) throws Exception {
145 FastReader in = new FastReader(System.in);

Callers 1

mainMethod · 0.95

Calls 2

findMethod · 0.95
unionMethod · 0.95

Tested by

no test coverage detected