From 111ab14b374cbca1def68ca42762e35d75070d4e Mon Sep 17 00:00:00 2001 From: Brett Laptop Date: Tue, 19 Dec 2023 01:28:59 -0500 Subject: [PATCH] small done --- include/blt/std/binary_tree.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/blt/std/binary_tree.h b/include/blt/std/binary_tree.h index ca553a0..b88f6b7 100755 --- a/include/blt/std/binary_tree.h +++ b/include/blt/std/binary_tree.h @@ -35,7 +35,6 @@ namespace blt node* left; node* right; - node(const T& t): val(t) {} @@ -103,6 +102,7 @@ namespace blt return; } node* search = root; + node* parent = nullptr; while (true) { if (t < search->val) @@ -110,7 +110,7 @@ namespace blt if (search->left == nullptr) { search->left = new node(t); - return; + break; } search = search->left; } else @@ -118,10 +118,11 @@ namespace blt if (search->right == nullptr) { search->right = new node(t); - return; + break; } search = search->right; } + parent = search; } }