Fix treap clear
This commit is contained in:
parent
a867520b0b
commit
8dfbc802d2
1 changed files with 2 additions and 2 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue