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

Method getSize

src/class184/Code05_Freezing1.java:60–69  ·  view source on GitHub ↗
(int u, int fa)

Source from the content-addressed store, hash-verified

58 }
59
60 public static void getSize(int u, int fa) {
61 siz[u] = 1;
62 for (int e = head[u]; e > 0; e = nxt[e]) {
63 int v = to[e];
64 if (v != fa && !vis[v]) {
65 getSize(v, u);
66 siz[u] += siz[v];
67 }
68 }
69 }
70
71 public static int getCentroid(int u, int fa) {
72 getSize(u, fa);

Callers 2

getCentroidMethod · 0.95
calcMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected