Support inserting a treap into another

This commit is contained in:
Matúš Púll 2025-04-09 14:12:41 +02:00
parent 944b6759ff
commit 3962f30539

View file

@ -110,6 +110,12 @@ public:
two.first = join(two.first, l);
root = join(two);
}
void insert(int k, treap t) {
// TODO test
auto two = split(root, k);
two.first = join(two.first, t.root);
root = join(two.first, two.second);
}
void append(string s) {
insert(size(), s);
}