From 92bc62380d8dee4d7013ea21035eb08b6c3caa3e Mon Sep 17 00:00:00 2001 From: Douglas Alves Date: Wed, 4 Dec 2024 07:38:12 -0300 Subject: [PATCH] Simplify treap insert (#281) --- content/data-structures/Treap.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/data-structures/Treap.h b/content/data-structures/Treap.h index aa1d3da4a..222edb2a2 100644 --- a/content/data-structures/Treap.h +++ b/content/data-structures/Treap.h @@ -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