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

Method centroidTree

src/class185/Code02_Game1.java:198–207  ·  view source on GitHub ↗
(int u, int fa)

Source from the content-addressed store, hash-verified

196 }
197
198 public static void centroidTree(int u, int fa) {
199 centfa[u] = fa;
200 vis[u] = true;
201 for (int e = head[u]; e > 0; e = nxt[e]) {
202 int v = to[e];
203 if (!vis[v]) {
204 centroidTree(getCentroid(v, u), u);
205 }
206 }
207 }
208
209 public static int add(int jobi, int jobv, int l, int r, int i) {
210 if (i == 0) {

Callers 1

mainMethod · 0.95

Calls 1

getCentroidMethod · 0.95

Tested by

no test coverage detected