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

Method subtreeSum

src/class161/Code01_HLD1.java:275–277  ·  view source on GitHub ↗
(int x)

Source from the content-addressed store, hash-verified

273
274 // x的子树上,查询所有节点的累加和
275 public static long subtreeSum(int x) {
276 return query(dfn[x], dfn[x] + siz[x] - 1, 1, n, 1);
277 }
278
279 public static void main(String[] args) throws IOException {
280 BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

Callers 1

mainMethod · 0.95

Calls 1

queryMethod · 0.95

Tested by

no test coverage detected