Add treap clearing
This commit is contained in:
parent
a20cd81dff
commit
7ca8b1a3cb
1 changed files with 7 additions and 0 deletions
|
@ -89,6 +89,13 @@ public:
|
||||||
// Don't find index k, but k-th line -> +1
|
// Don't find index k, but k-th line -> +1
|
||||||
return find(root, k+1);
|
return find(root, k+1);
|
||||||
}
|
}
|
||||||
|
void clear() {
|
||||||
|
while(size() > 0) {
|
||||||
|
auto two = split(root, 0);
|
||||||
|
root = two.second;
|
||||||
|
delete two.first;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Line insert
|
// Line insert
|
||||||
void insert(int k, string s) {
|
void insert(int k, string s) {
|
||||||
|
|
Loading…
Reference in a new issue