MCPcopy Create free account
hub / github.com/ShahjalalShohag/code-library / query

Method query

Data Structures/Segment Tree Merging.cpp:60–66  ·  view source on GitHub ↗

k -th sorted element in cur segment tree

Source from the content-addressed store, hash-verified

58 }
59 //k -th sorted element in cur segment tree
60 int query(int cur, int b, int e, int k) {
61 if(b == e) return b;
62 int lsz = t[lc].sz;
63 int mid = b + e >> 1;
64 if(k > lsz) return query(rc, mid + 1, e, k - lsz);
65 return query(lc, b, mid, k);
66 }
67} t;
68bool ty[N]; //0 - inc; 1 - dec
69//i-th pos store a substr (l, r) such that l = i (if exists)

Callers 1

queryFunction · 0.45

Calls 1

queryFunction · 0.70

Tested by

no test coverage detected