stack almost good

This commit is contained in:
hugogogo
2022-06-24 02:23:53 +02:00
parent 58d417742b
commit 6617d6cdf5
23 changed files with 3137 additions and 1081 deletions

View File

@@ -7,18 +7,24 @@
namespace ft {
template < typename ValueType >
struct node
{
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(const ValueType& val)
: value(val)
, up(NULL)
, left(NULL)
, right(NULL)
, height(1)
{}
node* min() {
node* min()
{
node* n = this;
while (n->left)
@@ -26,8 +32,8 @@ struct node
return n;
}
node* max()
{
node* max() {
node* n = this;
while (n->right)
@@ -37,8 +43,8 @@ struct node
};
template < typename ValueType >
struct node_sentinel
{
struct node_sentinel {
node<ValueType> *child;
node_sentinel() : child(NULL) {}