We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 85e20f4 commit cae666bCopy full SHA for cae666b
1 file changed
library/data_structures_[l,r)/seg_tree_uncommon/kth_smallest_query.hpp
@@ -20,18 +20,18 @@ struct kth_smallest {
20
//! @space O(log(maxv - minv)) for recursion stack; no
21
//! new nodes are allocated
22
int query(int l, int r, int k) {
23
- return query_impl(k, pst.root_l, pst.root_r,
+ return query(k, pst.root_l, pst.root_r,
24
pst.roots[l], pst.roots[r]);
25
}
26
- int query_impl(int k, int tl, int tr, int vl, int vr) {
+ int query(int k, int tl, int tr, int vl, int vr) {
27
if (tr - tl == 1) return tl;
28
int tm = tl + (tr - tl) / 2;
29
int left_count = pst.tree[pst.tree[vr].lch].sum -
30
pst.tree[pst.tree[vl].lch].sum;
31
if (left_count >= k)
32
- return query_impl(k, tl, tm, pst.tree[vl].lch,
+ return query(k, tl, tm, pst.tree[vl].lch,
33
pst.tree[vr].lch);
34
- return query_impl(k - left_count, tm, tr,
+ return query(k - left_count, tm, tr,
35
pst.tree[vl].rch, pst.tree[vr].rch);
36
37
};
0 commit comments