Iterator class.
More...
#include <bst.h>
|
std::ostream & | operator<< (std::ostream &out, bst< T > &t) |
| visualize function
|
|
template<typename T>
class bst< T >::Iterator
Iterator class.
◆ Iterator()
template<typename T>
bst< T >::Iterator::Iterator |
( |
const int64_t & | index, |
|
|
std::vector< T > & | els ) |
|
inlineexplicitnoexcept |
Construct a new Iterator object.
- Parameters
-
els | vector<T> - the elements in inorder fashion |
◆ begin()
pointer that points to begin
- Returns
- Iterator
◆ bst() [1/2]
Copy constructor for bst class.
- Parameters
-
b | the tree we want to copy |
◆ bst() [2/2]
bst< T >::bst |
( |
std::vector< T > | _elements = {} | ) |
|
|
inlineexplicitnoexcept |
Contructor for BST tree class.
- Parameters
-
__elements | you can directly pass a vector<T> so you don't have to do insert multiple times. |
◆ end()
pointer that points to end
- Returns
- Iterator
◆ inorder()
std::vector< T > bst< T >::inorder |
( |
| ) |
|
|
inline |
inorder function.
- Returns
- vector<T>, the elements inorder.
◆ insert()
void bst< T >::insert |
( |
T | key | ) |
|
|
inline |
insert function.
- Parameters
-
◆ level_order()
std::vector< std::vector< T > > bst< T >::level_order |
( |
| ) |
|
|
inline |
level order function
- Returns
- vector<vector<T>>, the level order traversal of the tree
◆ operator!=()
template<typename T>
bool bst< T >::Iterator::operator!= |
( |
const Iterator & | it | ) |
|
|
inline |
operator != for type Iterator
- Parameters
-
- Returns
- true if index == it.index
-
false otherwise
◆ operator*()
template<typename T>
T bst< T >::Iterator::operator* |
( |
| ) |
|
|
inline |
operator * for type Iterator
- Returns
- T the value of the node
◆ operator++() [1/2]
◆ operator++() [2/2]
◆ operator--() [1/2]
◆ operator--() [2/2]
◆ operator=() [1/2]
operator = for bst class
- Parameters
-
b | the tree we want to copy |
- Returns
- bst&
◆ operator=() [2/2]
template<typename T>
Iterator & bst< T >::Iterator::operator= |
( |
int64_t | index | ) |
|
|
inline |
◆ postorder()
std::vector< T > bst< T >::postorder |
( |
| ) |
|
|
inline |
postorder function.
- Returns
- vector<T>, the elements postorder.
◆ preorder()
std::vector< T > bst< T >::preorder |
( |
| ) |
|
|
inline |
preorder function.
- Returns
- vector<T>, the elements preorder.
◆ remove()
void bst< T >::remove |
( |
T | key | ) |
|
|
inline |
remove function.
- Parameters
-
◆ search()
bool bst< T >::search |
( |
T | key | ) |
|
|
inline |
search function.
- Parameters
-
- Returns
- true if the key exists in the tree.
◆ size()
size_t bst< T >::size |
( |
| ) |
|
|
inline |
size function
- Returns
- size_t the size of the tree
◆ operator<<
std::ostream & operator<< |
( |
std::ostream & | out, |
|
|
bst< T > & | t ) |
|
friend |
visualize function
- Returns
- .dot file that can be previewed using graphviz in vscode.
operator << for bst class
The documentation for this class was generated from the following file:
- /Users/runner/work/AlgoPlus/AlgoPlus/src/classes/tree/bst.h