#include <splay_tree.hpp>
Public Types | |
using | value_type = V |
using | node_type = Node< value_type > |
using | node_ptr = std::unique_ptr< node_type > |
Public Member Functions | |
Node (const value_type &val) | |
Node (const Node &n) | |
constructor | |
node_type * | parent () |
void | set_parent (node_type *p) |
void | make_root () |
detaches this node from parent | |
node_ptr & | left () |
void | set_left (node_ptr node) |
sets left child pointer More... | |
node_ptr & | right () |
void | set_right (node_ptr node) |
template<typename Direction > | |
void | set (node_ptr node, Direction dir_tag) |
sets child pointer More... | |
template<typename Direction > | |
void | set_internal (node_ptr node, Direction dir_tag) |
sets child pointer (no relaxation) More... | |
void | update_size () |
recomputes subtree size from sizes of children's subtrees | |
node_ptr & | child (reversed_tag) |
node_ptr & | child (forward_tag) |
template<typename Direction > | |
node_type * | extreme (Direction dir_tag) |
template<typename Direction > | |
node_type * | advance (Direction dir_tag) |
node_type * | next () |
node_type * | prev () |
std::size_t | size () |
void | subtree_reverse () |
lazily reverses order in subtree | |
void | normalize () |
locally relaxes tree | |
void | normalize_root_path () |
relaxes all nodes on path from root to this | |
Public Attributes | |
value_type | val_ |
value of the node | |
Node of a splay_tree.
Left/right relaxation should be understood as follows. Meaning of left/right field changes iff xor of all bits on the path to the root is 1. This enables us to reverse entire subtree in constant time (by flipping bit in the root). Normalization is needed to determine which child is the real left/right.
Definition at line 42 of file splay_tree.hpp.
|
inlineexplicit |
val | stored value |
Definition at line 86 of file splay_tree.hpp.
|
inline |
Definition at line 175 of file splay_tree.hpp.
|
inline |
Definition at line 110 of file splay_tree.hpp.
|
inline |
Definition at line 197 of file splay_tree.hpp.
|
inline |
Definition at line 102 of file splay_tree.hpp.
|
inline |
Definition at line 202 of file splay_tree.hpp.
|
inline |
Definition at line 124 of file splay_tree.hpp.
|
inline |
|
inline |
sets child pointer (no relaxation)
node | new child |
Definition at line 148 of file splay_tree.hpp.
|
inline |
|
inline |
Definition at line 207 of file splay_tree.hpp.