We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent de85fc7 commit b6231f3Copy full SHA for b6231f3
content/data-structures/Treap.h
@@ -25,13 +25,13 @@ template<class F> void each(Node* n, F f) {
25
26
pair<Node*, Node*> split(Node* n, int k) {
27
if (!n) return {};
28
- if (cnt(n->l) >= k) { // "n->val >= v" for lower_bound(v)
+ if (cnt(n->l) >= k) { // "n->val >= k" for lower_bound(k)
29
auto pa = split(n->l, k);
30
n->l = pa.second;
31
n->recalc();
32
return {pa.first, n};
33
} else {
34
- auto pa = split(n->r, k - cnt(n->l) - 1);
+ auto pa = split(n->r, k - cnt(n->l) - 1); // and just "k"
35
n->r = pa.first;
36
37
return {n, pa.second};
0 commit comments