From 1582e7e7cb9a63629fd9747fa0e4873d4a0459c0 Mon Sep 17 00:00:00 2001 From: Matuush Date: Sun, 30 Mar 2025 17:01:40 +0200 Subject: [PATCH] Update treap root on insert --- file.hpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/file.hpp b/file.hpp index 060908c..e7c2381 100644 --- a/file.hpp +++ b/file.hpp @@ -30,7 +30,6 @@ public: // Hopefully with sizes two_lines split(line *l, count_type k) { if(l == nullptr) return {nullptr, nullptr}; - // TODO ??????? sizes dont add up if(get_size(l->left) >= k) { // In the left subtree @@ -103,12 +102,12 @@ public: auto two = split(root, k); two.first = join(two.first, l); - join(two); + root = join(two); } // Line removal void remove(count_type k) { auto two = split(root, k+1); two.first = split(two.first, k).first; - join(two); + root = join(two); } };