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

Method prepare

src/class154/FollowUp1.java:36–44  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

34 public static int[] root = new int[MAXN];
35
36 public static void prepare() {
37 dist[0] = -1;
38 for (int i = 1; i <= n; i++) {
39 up[i] = ls[i] = rs[i] = dist[i] = 0;
40 father[i] = i;
41 // 初始每个集合i只有元素i
42 root[i] = i;
43 }
44 }
45
46 public static int find(int i) {
47 father[i] = father[i] == i ? i : find(father[i]);

Callers 1

mainMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected