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

Method query

src/class173/Code05_HLD1.java:224–240  ·  view source on GitHub ↗
(int l, int r)

Source from the content-addressed store, hash-verified

222 }
223
224 public static void query(int l, int r) {
225 if (bi[l] == bi[r]) {
226 for (int i = l; i <= r; i++) {
227 ans.setOne(val[i]);
228 }
229 } else {
230 for (int i = l; i <= br[bi[l]]; i++) {
231 ans.setOne(val[i]);
232 }
233 for (int i = bl[bi[r]]; i <= r; i++) {
234 ans.setOne(val[i]);
235 }
236 for (int i = bi[l] + 1; i <= bi[r] - 1; i++) {
237 ans.or(bitSet[i]);
238 }
239 }
240 }
241
242 public static void updateAns(int x, int y) {
243 while (top[x] != top[y]) {

Callers 1

updateAnsMethod · 0.95

Calls 2

setOneMethod · 0.45
orMethod · 0.45

Tested by

no test coverage detected