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

Method up

src/class161/Code06_Tourism1.java:177–183  ·  view source on GitHub ↗
(int i)

Source from the content-addressed store, hash-verified

175 }
176
177 public static void up(int i) {
178 int l = i << 1, r = i << 1 | 1;
179 max[i] = Math.max(max[l], max[r]);
180 min[i] = Math.min(min[l], min[r]);
181 lprofit[i] = Math.max(Math.max(lprofit[l], lprofit[r]), max[r] - min[l]);
182 rprofit[i] = Math.max(Math.max(rprofit[l], rprofit[r]), max[l] - min[r]);
183 }
184
185 public static void lazy(int i, int v) {
186 max[i] += v;

Callers 2

buildMethod · 0.95
addMethod · 0.95

Calls 1

maxMethod · 0.45

Tested by

no test coverage detected