stack almost good
This commit is contained in:
@@ -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) {}
|
||||
|
||||
Reference in New Issue
Block a user