![]() |
aGrUM
0.16.0
|
the nodes of splay trees More...
#include <agrum/core/splay.h>
Protected Attributes | |
Data Members | |
Element | elt |
The content. More... | |
Size | size |
The size of the sub-tree. More... | |
SplayBinaryNode * | fg |
The left child. More... | |
SplayBinaryNode * | fd |
The right child. More... | |
SplayBinaryNode * | pere |
The father, nullptr for the root. More... | |
Protected Member Functions | |
Constructors / Destructors | |
SplayBinaryNode (const Element &e, HashTable< Element, SplayBinaryNode< Element > * > &addr, SplayBinaryNode *g=0, SplayBinaryNode *d=0, SplayBinaryNode *p=0) | |
Basic constructor: creates a node with a reference to the element. More... | |
SplayBinaryNode (const SplayBinaryNode< Element > &from, HashTable< Element, SplayBinaryNode< Element > * > &addr) | |
Copy constructor. More... | |
void | _copy (const SplayBinaryNode< Element > &from, HashTable< Element, SplayBinaryNode< Element > * > &addr) |
A function used to perform copies. More... | |
~SplayBinaryNode () | |
Class destructor. More... | |
Friends | |
class | SplayTree< Element > |
Friendly with SplayTree. More... | |
std::ostream & | operator<< (std::ostream &out, const SplayBinaryNode< Element > &) |
Friendly to display. More... | |
Accessors / Modifiers | |
int | position () const |
Position of the node. More... | |
const Element & | getElement () const |
Returns the element in the node. More... | |
const SplayBinaryNode< Element > * | getFg () const |
Returns the left child. More... | |
const SplayBinaryNode< Element > * | getFd () const |
Returns the right child. More... | |
SplayBinaryNode< Element > * | zig () |
A right rotation, the node must have a father. More... | |
SplayBinaryNode< Element > * | zag () |
A left rotation, the node must hava a father. More... | |
SplayBinaryNode< Element > * | splay () |
A splay rotation, the node will be the root of the tree. More... | |
SplayBinaryNode< Element > * | join (const SplayBinaryNode< Element > *e, HashTable< Element, SplayBinaryNode< Element > * > &addr) |
Concatenation of two trees. More... | |
the nodes of splay trees
These file implements a data structure. A splay tree is a self-balancing binary search tree.
|
protected |
Basic constructor: creates a node with a reference to the element.
e | The element in the node. |
addr | TODO don't know what to do here. |
g | The left child of the node, can be nullptr. |
d | The right child of the node, can be nullptr. |
p | The father of the node, can be nullptr if the node is the root of the tree. |
Definition at line 73 of file splay_tpl.h.
References gum::SplayBinaryNode< Element >::elt.
|
protected |
Copy constructor.
from | the src SplayBinaryNode |
addr | TODO don't know what to do here. |
Definition at line 93 of file splay_tpl.h.
References gum::SplayBinaryNode< Element >::_copy().
|
protected |
Class destructor.
Definition at line 104 of file splay_tpl.h.
References gum::SplayBinaryNode< Element >::fd, and gum::SplayBinaryNode< Element >::fg.
|
protected |
A function used to perform copies.
from | the src SplayBinaryNode |
addr | TODO don't know what to do here .. |
Definition at line 41 of file splay_tpl.h.
References gum::SplayBinaryNode< Element >::elt, gum::SplayBinaryNode< Element >::fd, gum::SplayBinaryNode< Element >::fg, gum::SplayBinaryNode< Element >::pere, and gum::SplayBinaryNode< Element >::size.
Referenced by gum::SplayBinaryNode< Element >::SplayBinaryNode().
INLINE const Element & gum::SplayBinaryNode< Element >::getElement | ( | ) | const |
Returns the element in the node.
Definition at line 320 of file splay_tpl.h.
References gum::SplayBinaryNode< Element >::elt.
Referenced by gum::removeInfo().
INLINE const SplayBinaryNode< Element > * gum::SplayBinaryNode< Element >::getFd | ( | ) | const |
Returns the right child.
Definition at line 342 of file splay_tpl.h.
References gum::SplayBinaryNode< Element >::fd.
Referenced by gum::removeInfo().
INLINE const SplayBinaryNode< Element > * gum::SplayBinaryNode< Element >::getFg | ( | ) | const |
Returns the left child.
Definition at line 331 of file splay_tpl.h.
References gum::SplayBinaryNode< Element >::fg.
Referenced by gum::removeInfo().
|
protected |
Concatenation of two trees.
e | The node to add. |
addr | TODO Don't know what to do here. |
Definition at line 263 of file splay_tpl.h.
References gum::SplayBinaryNode< Element >::fd, gum::SplayBinaryNode< Element >::fg, gum::SplayBinaryNode< Element >::pere, gum::SplayBinaryNode< Element >::size, and gum::SplayBinaryNode< Element >::splay().
INLINE int gum::SplayBinaryNode< Element >::position | ( | ) | const |
Position of the node.
Definition at line 293 of file splay_tpl.h.
References gum::SplayBinaryNode< Element >::fd, gum::SplayBinaryNode< Element >::fg, gum::SplayBinaryNode< Element >::pere, gum::SplayBinaryNode< Element >::position(), and gum::SplayBinaryNode< Element >::size.
Referenced by gum::SplayBinaryNode< Element >::position(), and gum::SplayTree< Element >::split().
|
protected |
A splay rotation, the node will be the root of the tree.
Definition at line 218 of file splay_tpl.h.
References gum::SplayBinaryNode< Element >::fd, gum::SplayBinaryNode< Element >::fg, gum::SplayBinaryNode< Element >::pere, gum::SplayBinaryNode< Element >::zag(), and gum::SplayBinaryNode< Element >::zig().
Referenced by gum::SplayTree< Element >::back(), gum::SplayTree< Element >::front(), gum::SplayBinaryNode< Element >::join(), gum::SplayTree< Element >::operator[](), gum::SplayTree< Element >::popBack(), gum::SplayTree< Element >::popFront(), gum::SplayTree< Element >::pushBack(), gum::SplayTree< Element >::pushFront(), gum::SplayTree< Element >::split(), and gum::SplayTree< Element >::split_by_val().
|
protected |
A left rotation, the node must hava a father.
Definition at line 168 of file splay_tpl.h.
References gum::SplayBinaryNode< Element >::fd, gum::SplayBinaryNode< Element >::fg, gum::SplayBinaryNode< Element >::pere, and gum::SplayBinaryNode< Element >::size.
Referenced by gum::SplayBinaryNode< Element >::splay().
|
protected |
A right rotation, the node must have a father.
Definition at line 117 of file splay_tpl.h.
References gum::SplayBinaryNode< Element >::fd, gum::SplayBinaryNode< Element >::fg, gum::SplayBinaryNode< Element >::pere, and gum::SplayBinaryNode< Element >::size.
Referenced by gum::SplayBinaryNode< Element >::splay().
|
friend |
Friendly to display.
Definition at line 795 of file splay_tpl.h.
|
friend |
|
protected |
The content.
Definition at line 191 of file splay.h.
Referenced by gum::SplayBinaryNode< Element >::_copy(), gum::SplayBinaryNode< Element >::getElement(), gum::operator<<(), and gum::SplayBinaryNode< Element >::SplayBinaryNode().
|
protected |
The right child.
Definition at line 200 of file splay.h.
Referenced by gum::SplayBinaryNode< Element >::_copy(), gum::SplayTree< Element >::back(), gum::SplayBinaryNode< Element >::getFd(), gum::SplayTree< Element >::insert(), gum::SplayBinaryNode< Element >::join(), gum::operator<<(), gum::SplayTree< Element >::operator[](), gum::SplayTree< Element >::popBack(), gum::SplayTree< Element >::popFront(), gum::SplayBinaryNode< Element >::position(), gum::SplayTree< Element >::pushBack(), gum::SplayBinaryNode< Element >::splay(), gum::SplayTree< Element >::split(), gum::SplayTree< Element >::split_by_val(), gum::SplayBinaryNode< Element >::zag(), gum::SplayBinaryNode< Element >::zig(), and gum::SplayBinaryNode< Element >::~SplayBinaryNode().
|
protected |
The left child.
Definition at line 197 of file splay.h.
Referenced by gum::SplayBinaryNode< Element >::_copy(), gum::SplayTree< Element >::front(), gum::SplayBinaryNode< Element >::getFg(), gum::SplayBinaryNode< Element >::join(), gum::operator<<(), gum::SplayTree< Element >::operator[](), gum::SplayTree< Element >::popBack(), gum::SplayTree< Element >::popFront(), gum::SplayBinaryNode< Element >::position(), gum::SplayTree< Element >::pushFront(), gum::SplayBinaryNode< Element >::splay(), gum::SplayTree< Element >::split(), gum::SplayTree< Element >::split_by_val(), gum::SplayBinaryNode< Element >::zag(), gum::SplayBinaryNode< Element >::zig(), and gum::SplayBinaryNode< Element >::~SplayBinaryNode().
|
protected |
The father, nullptr for the root.
Definition at line 203 of file splay.h.
Referenced by gum::SplayBinaryNode< Element >::_copy(), gum::SplayBinaryNode< Element >::join(), gum::SplayBinaryNode< Element >::position(), gum::SplayBinaryNode< Element >::splay(), gum::SplayBinaryNode< Element >::zag(), and gum::SplayBinaryNode< Element >::zig().
|
protected |
The size of the sub-tree.
Definition at line 194 of file splay.h.
Referenced by gum::SplayBinaryNode< Element >::_copy(), gum::SplayTree< Element >::insert(), gum::SplayBinaryNode< Element >::join(), gum::SplayBinaryNode< Element >::position(), gum::SplayBinaryNode< Element >::zag(), and gum::SplayBinaryNode< Element >::zig().