Generalize treap count type
This commit is contained in:
parent
08556a4dcc
commit
5feb4bb93d
1 changed files with 3 additions and 3 deletions
|
@ -20,7 +20,7 @@ class treap {
|
||||||
line* root;
|
line* root;
|
||||||
|
|
||||||
// Get size uf a subtreap
|
// Get size uf a subtreap
|
||||||
int get_size(line* l) {
|
count_type get_size(line* l) {
|
||||||
if(l == nullptr) return 0;
|
if(l == nullptr) return 0;
|
||||||
return l->size;
|
return l->size;
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Line insert
|
// Line insert
|
||||||
void insert(int k, string s) {
|
void insert(count_type k, string s) {
|
||||||
line *l = new line(rand(), s);
|
line *l = new line(rand(), s);
|
||||||
|
|
||||||
if(root == nullptr) {
|
if(root == nullptr) {
|
||||||
|
@ -110,7 +110,7 @@ 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) {
|
void insert(count_type k, treap t) {
|
||||||
// TODO test
|
// TODO test
|
||||||
auto two = split(root, k);
|
auto two = split(root, k);
|
||||||
two.first = join(two.first, t.root);
|
two.first = join(two.first, t.root);
|
||||||
|
|
Loading…
Reference in a new issue