From 33ee1f2dc7b1653be7ae228648cfd9598555a70d Mon Sep 17 00:00:00 2001 From: Brett Date: Tue, 10 Jan 2023 22:58:49 -0500 Subject: [PATCH] Fix insert? --- include/blt/std/binary_tree.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/blt/std/binary_tree.h b/include/blt/std/binary_tree.h index c5420ef..5ec88c5 100644 --- a/include/blt/std/binary_tree.h +++ b/include/blt/std/binary_tree.h @@ -47,11 +47,11 @@ namespace blt { if (element == searchNode->payload) throw binary_search_tree_error{"Unable to insert. Nodes cannot have equal values!\n"}; // check for left and right tree traversal if it exists - if (searchNode->left != nullptr && element < searchNode->left->payload) { + if (searchNode->left != nullptr && element < searchNode->payload) { searchNode = searchNode->left; continue; } - if (searchNode->right != nullptr && element > searchNode->right->payload) { + if (searchNode->right != nullptr && element > searchNode->payload) { searchNode = searchNode->right; continue; }