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

Method kthMax

src/class164/Code07_Peaks1.java:197–208  ·  view source on GitHub ↗
(int u, int x, int k)

Source from the content-addressed store, hash-verified

195 }
196
197 public static int kthMax(int u, int x, int k) {
198 for (int p = MAXP - 1; p >= 0; p--) {
199 if (stjump[u][p] > 0 && nodeKey[stjump[u][p]] <= x) {
200 u = stjump[u][p];
201 }
202 }
203 if (leafsiz[u] < k) {
204 return 0;
205 }
206 int idx = query(k, 1, s, root[leafDfnMin[u] - 1], root[leafDfnMin[u] + leafsiz[u] - 1]);
207 return sorted[idx];
208 }
209
210 public static void main(String[] args) {
211 FastIO io = new FastIO(System.in, System.out);

Callers 1

mainMethod · 0.95

Calls 1

queryMethod · 0.95

Tested by

no test coverage detected