Skip to content

Commit

Permalink
Merge pull request #38 from DannyAntonelli/master
Browse files Browse the repository at this point in the history
Fix Treap
  • Loading branch information
DannyAntonelli authored Feb 27, 2023
2 parents 3c8dd1c + 8c492ea commit ae02604
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions source/treap.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ struct Treap {
int prio, sz;
Treap *left, *right;

Treap(Val x, Treap* l = NULL, Treap *r = NULL) {
val = x; sz = 1; prio = rng();
left = l; right = r; rev = false; sum = 0;
}
Treap(Val x)
: val(x), sum(x), rev(false), prio(rng()), sz(1), left(nullptr), right(nullptr) {}
~Treap() {
if(left) delete left;
if(right) delete right;
Expand Down

0 comments on commit ae02604

Please sign in to comment.