Advanced Programming - Binary Search Tree
A simple Binary Search Tree implementation for the Advanced Programming 2019-2020 course @ SISSA.
|
Class that implements a node of a tree. More...
#include <Node.hpp>
Public Member Functions | |
Node () noexcept | |
Void constructor. More... | |
Node (const T &data, Node< T > *parent) noexcept | |
Copy constructor with data. More... | |
Node (T &&data, Node< T > *parent) noexcept | |
Move constructor with data. More... | |
void | printNode (std::ostream &os, const bool &printChildren) |
Utility function that prints a Node. More... | |
void | printNode () |
Utility function that prints a Node. More... | |
Public Attributes | |
T | data |
Data stored in this Node. More... | |
std::unique_ptr< Node< T > > | left |
Left child of this Node. | |
std::unique_ptr< Node< T > > | right |
Right child of this Node. | |
Node< T > * | parent |
Parent of this Node. | |
Class that implements a node of a tree.
General class that can be used in any tree, for example it could be used in a class bt
that implements a Binary Tree (and then APbst::bst could inherit from bt
).
|
inlinenoexcept |
Void constructor.
Used only to create a void root
Node when an object APbst::bst is instantiated.
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
|
inline |
Utility function that prints a Node.
Overloaded printNode() that prints, without arguments, each node and their children to std::cout
.
T APutils::Node< T >::data |
Data stored in this Node.
E.g. for a APbst::bst std::pair<const Key,Value>
, where Key
is the key of this Node and Value
is the value stored in this Node.