Add treap clearing

This commit is contained in:
Matúš Púll 2025-04-09 08:00:51 +02:00
parent a20cd81dff
commit 7ca8b1a3cb

View file

@ -89,6 +89,13 @@ public:
// Don't find index k, but k-th line -> +1
return find(root, k+1);
}
void clear() {
while(size() > 0) {
auto two = split(root, 0);
root = two.second;
delete two.first;
}
}
// Line insert
void insert(int k, string s) {