![]() |
aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
|
the nodes of splay trees More...
#include <agrum/base/core/splay.h>
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. | |
| SplayBinaryNode (const SplayBinaryNode< Element > &from, HashTable< Element, SplayBinaryNode< Element > * > &addr) | |
| Copy constructor. | |
| void | copy_ (const SplayBinaryNode< Element > &from, HashTable< Element, SplayBinaryNode< Element > * > &addr) |
| A function used to perform copies. | |
| ~SplayBinaryNode () | |
| Class destructor. | |
Protected Attributes | |
Data Members | |
| Element | elt |
| The content. | |
| Size | size |
| The size of the sub-tree. | |
| SplayBinaryNode * | fg |
| The left child. | |
| SplayBinaryNode * | fd |
| The right child. | |
| SplayBinaryNode * | pere |
| The father, nullptr for the root. | |
Friends | |
| class | SplayTree< Element > |
| Friendly with SplayTree. | |
| std::ostream & | operator<< (std::ostream &out, const SplayBinaryNode< Element > &e) |
| Friendly to display. | |
Accessors / Modifiers | |
| int | position () const |
| Position of the node. | |
| const Element & | getElement () const |
| Returns the element in the node. | |
| const SplayBinaryNode< Element > * | getFg () const |
| Returns the left child. | |
| const SplayBinaryNode< Element > * | getFd () const |
| Returns the right child. | |
| SplayBinaryNode< Element > * | zig () |
| A right rotation, the node must have a father. | |
| SplayBinaryNode< Element > * | zag () |
| A left rotation, the node must hava a father. | |
| SplayBinaryNode< Element > * | splay () |
| A splay rotation, the node will be the root of the tree. | |
| SplayBinaryNode< Element > * | join (const SplayBinaryNode< Element > *e, HashTable< Element, SplayBinaryNode< Element > * > &addr) |
| Concatenation of two trees. | |
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 91 of file splay_tpl.h.
References SplayBinaryNode(), elt, fd, fg, pere, and size.
Referenced by SplayBinaryNode(), SplayBinaryNode(), ~SplayBinaryNode(), copy_(), getFd(), getFg(), join(), operator<<, splay(), zag(), and zig().
|
protected |
Copy constructor.
| from | the src SplayBinaryNode |
| addr | TODO don't know what to do here. |
Definition at line 107 of file splay_tpl.h.
References SplayBinaryNode(), and copy_().
|
protected |
Class destructor.
Definition at line 118 of file splay_tpl.h.
References SplayBinaryNode(), fd, and fg.
|
protected |
A function used to perform copies.
| from | the src SplayBinaryNode |
| addr | TODO don't know what to do here .. |
Definition at line 62 of file splay_tpl.h.
References SplayBinaryNode(), elt, fd, fg, pere, and size.
Referenced by SplayBinaryNode().
| INLINE const Element & gum::SplayBinaryNode< Element >::getElement | ( | ) | const |
Returns the element in the node.
Definition at line 332 of file splay_tpl.h.
References elt.
Referenced by gum::removeInfo().
| INLINE const SplayBinaryNode< Element > * gum::SplayBinaryNode< Element >::getFd | ( | ) | const |
Returns the right child.
Definition at line 352 of file splay_tpl.h.
References SplayBinaryNode(), and fd.
Referenced by gum::removeInfo().
| INLINE const SplayBinaryNode< Element > * gum::SplayBinaryNode< Element >::getFg | ( | ) | const |
Returns the left child.
Definition at line 342 of file splay_tpl.h.
References SplayBinaryNode(), and 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 278 of file splay_tpl.h.
References SplayBinaryNode(), fd, fg, pere, size, and splay().
| INLINE int gum::SplayBinaryNode< Element >::position | ( | ) | const |
Position of the node.
Definition at line 307 of file splay_tpl.h.
Referenced by gum::SplayTree< Element >::split().
|
protected |
A splay rotation, the node will be the root of the tree.
Definition at line 232 of file splay_tpl.h.
References SplayBinaryNode(), fd, fg, pere, zag(), and zig().
Referenced by gum::SplayTree< Element >::back(), gum::SplayTree< Element >::front(), gum::SplayTree< Element >::insert(), join(), gum::SplayTree< Element >::operator[](), 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 182 of file splay_tpl.h.
References SplayBinaryNode(), fd, fg, pere, and size.
Referenced by splay().
|
protected |
A right rotation, the node must have a father.
Definition at line 131 of file splay_tpl.h.
References SplayBinaryNode(), fd, fg, pere, and size.
Referenced by splay().
|
friend |
|
protected |
The content.
Definition at line 208 of file splay.h.
Referenced by SplayBinaryNode(), copy_(), getElement(), and operator<<.
|
protected |
The right child.
Definition at line 217 of file splay.h.
Referenced by SplayBinaryNode(), ~SplayBinaryNode(), gum::SplayTree< Element >::back(), copy_(), getFd(), gum::SplayTree< Element >::insert(), join(), operator<<, gum::SplayTree< Element >::operator[](), gum::SplayTree< Element >::operator[](), gum::SplayTree< Element >::popBack(), gum::SplayTree< Element >::popFront(), position(), gum::SplayTree< Element >::pushBack(), splay(), gum::SplayTree< Element >::split(), gum::SplayTree< Element >::split_by_val(), zag(), and zig().
|
protected |
The left child.
Definition at line 214 of file splay.h.
Referenced by SplayBinaryNode(), ~SplayBinaryNode(), copy_(), gum::SplayTree< Element >::front(), getFg(), join(), operator<<, gum::SplayTree< Element >::operator[](), gum::SplayTree< Element >::operator[](), gum::SplayTree< Element >::popBack(), gum::SplayTree< Element >::popFront(), position(), gum::SplayTree< Element >::pushFront(), splay(), gum::SplayTree< Element >::split(), gum::SplayTree< Element >::split_by_val(), zag(), and zig().
|
protected |
The father, nullptr for the root.
Definition at line 220 of file splay.h.
Referenced by SplayBinaryNode(), copy_(), join(), position(), splay(), zag(), and zig().
|
protected |
The size of the sub-tree.
Definition at line 211 of file splay.h.
Referenced by SplayBinaryNode(), copy_(), gum::SplayTree< Element >::insert(), join(), gum::SplayTree< Element >::operator[](), gum::SplayTree< Element >::operator[](), zag(), and zig().