Files
42_INT_11_ft_containers/headers/bst_node.hpp
2022-06-20 19:05:52 +02:00

51 lines
626 B
C++

#ifndef BST_NODE_HPP
# define BST_NODE_HPP
# include <cstddef> // NULL
namespace ft {
template < typename ValueType >
struct node
{
ValueType value;
node *up;
node *left;
node *right;
short height;
node(const ValueType& val) : value(val), up(NULL), left(NULL), right(NULL), height(1) {}
node* min()
{
node* n = this;
while (n->left)
n = n->left;
return n;
}
node* max()
{
node* n = this;
while (n->right)
n = n->right;
return n;
}
};
template < typename ValueType >
struct node_sentinel
{
node<ValueType> *child;
node_sentinel() : child(NULL) {}
};
} // namespace ft
#endif