Support inserting a treap into another
This commit is contained in:
parent
944b6759ff
commit
3962f30539
1 changed files with 6 additions and 0 deletions
|
@ -110,6 +110,12 @@ public:
|
||||||
two.first = join(two.first, l);
|
two.first = join(two.first, l);
|
||||||
root = join(two);
|
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) {
|
void append(string s) {
|
||||||
insert(size(), s);
|
insert(size(), s);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue