Fix treap clear

This commit is contained in:
Matúš Púll 2025-04-15 16:46:18 +02:00
parent a867520b0b
commit 8dfbc802d2

View file

@ -1,6 +1,7 @@
#include <string> #include <string>
#include <cstdlib> #include <cstdlib>
#include <utility> #include <utility>
#include <iostream>
using std::string; using std::string;
typedef unsigned long long count_type; typedef unsigned long long count_type;
@ -91,11 +92,10 @@ public:
} }
void clear() { void clear() {
while(size() > 0) { while(size() > 0) {
auto two = split(root, 0); auto two = split(root, 1);
root = two.second; root = two.second;
delete two.first; delete two.first;
} }
root = nullptr;
} }
// Line insert // Line insert