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

Method centroidTree

src/class185/Code01_Wave1.java:250–259  ·  view source on GitHub ↗
(int u, int fa)

Source from the content-addressed store, hash-verified

248 }
249
250 public static void centroidTree(int u, int fa) {
251 centfa[u] = fa;
252 vis[u] = true;
253 for (int e = head[u]; e > 0; e = nxt[e]) {
254 int v = to[e];
255 if (!vis[v]) {
256 centroidTree(getCentroid(v, u), u);
257 }
258 }
259 }
260
261 public static int add(int jobi, int jobv, int l, int r, int i) {
262 if (i == 0) {

Callers 1

mainMethod · 0.95

Calls 1

getCentroidMethod · 0.95

Tested by

no test coverage detected