diff --git a/include/blt/std/binary_tree.h b/include/blt/std/binary_tree.h index a648d1d..6598279 100644 --- a/include/blt/std/binary_tree.h +++ b/include/blt/std/binary_tree.h @@ -107,17 +107,18 @@ namespace blt { node_binary_search_tree() { m_root = new BST_node(); } - - void insert(const T& element) { + + inline void insert(const T& element) { insert(m_root, element); } - [[nodiscard]] BST_node* search(const T& element) const { - return search(nullptr, element); + [[nodiscard]] inline BST_node* search(const T& element) const { + BST_node parent; + return search(&parent, element); } void remove(const T& element) { - BST_node* parent = nullptr; + BST_node* parent {}; BST_node* elementNode = search(parent, element); BST_node*& parentChildSide = parent->left; @@ -142,11 +143,11 @@ namespace blt { delete(elementNode); } - std::vector inOrderTraverse(){ + inline std::vector inOrderTraverse(){ return inOrderTraverse(m_root); } - - BST_node* debug(){ + + inline BST_node* debug(){ return m_root; }