Skip to content

Commit

Permalink
Simplify treap insert (#281)
Browse files Browse the repository at this point in the history
  • Loading branch information
douglasalves0 authored Dec 4, 2024
1 parent 0f8a6aa commit 92bc623
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions content/data-structures/Treap.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ Node* merge(Node* l, Node* r) {
}

Node* ins(Node* t, Node* n, int pos) {
auto pa = split(t, pos);
return merge(merge(pa.first, n), pa.second);
auto [l,r] = split(t, pos);
return merge(merge(l, n), r);
}

// Example application: move the range [l, r) to index k
Expand Down

0 comments on commit 92bc623

Please sign in to comment.