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

Method build

src/class111/Code03_SquareRoot.java:36–46  ·  view source on GitHub ↗
(int l, int r, int i)

Source from the content-addressed store, hash-verified

34 }
35
36 public static void build(int l, int r, int i) {
37 if (l == r) {
38 sum[i] = arr[l];
39 max[i] = arr[l];
40 } else {
41 int mid = (l + r) >> 1;
42 build(l, mid, i << 1);
43 build(mid + 1, r, i << 1 | 1);
44 up(i);
45 }
46 }
47
48 // sqrt方法是最核心的
49 // 注意和常规线段树不一样,这里没有懒更新,也就不需要有down方法

Callers 1

mainMethod · 0.95

Calls 1

upMethod · 0.95

Tested by

no test coverage detected