|
Brumski's DSA Learning Project 1.3
For Learning Data Structures and Algorithms in C++
|
This is a template class that represents a Binary Search Tree. More...
#include <binary_tree.hpp>
Classes | |
| class | BSTNode |
| This is a template class that represents a node/element in a Binary Search Tree. More... | |
Public Member Functions | |
| virtual void | insert (const T &value) |
| Inserts a value into the binary search tree. | |
| virtual void | display (const bool &ascOrder=true) |
| Displays all the values in the binary search tree. | |
| virtual bool | search (const T &data) |
| Searches for an element in the binary search tree. | |
Private Member Functions | |
| virtual std::unique_ptr< BSTNode< T > > | insertHelper (std::unique_ptr< BSTNode< T > > &root, std::unique_ptr< BSTNode< T > > &node) |
| Helper to BSTree<T>::insert() | |
| virtual bool | searchHelper (std::unique_ptr< BSTNode< T > > &root, const T &data) |
| Helper to BSTree<T>::search() | |
Static Private Member Functions | |
| static void | displayHelper (std::unique_ptr< BSTNode< T > > &root, const bool &ascendingOrder=true) |
| Helper to BSTree<T>::display() | |
This is a template class that represents a Binary Search Tree.
It can take any basic C++ data type.
|
inlinevirtual |
Displays all the values in the binary search tree.
| ascendingOrder | - boolean variable that will decide if the traversal will be in ascending or descending order |
|
inlinestaticprivate |
Helper to BSTree<T>::display()
| root | - the root node |
| ascendingOrder | - boolean variable that will decide if the traversal will be in ascending or descending order |
|
inlinevirtual |
Inserts a value into the binary search tree.
| value | - The value you want inside the BST |
|
inlineprivatevirtual |
Helper to BSTree<T>::insert()
| root | - the root node |
| node | - a new node |
|
inlinevirtual |
Searches for an element in the binary search tree.
| data | - the element that you want to search for |
|
inlineprivatevirtual |
Helper to BSTree<T>::search()
| root | - the root node |
| data | - the element that you want to search for |