detail More...
#include <splay_tree.hpp>
Public Types | |
using | value_type = T |
using | node_type = detail::Node< value_type > |
using | node_ptr = typename node_type::node_ptr |
using | iterator = detail::Iterator< value_type, detail::forward_tag > |
using | const_iterator = const iterator |
using | reverse_iterator = detail::Iterator< value_type, detail::reversed_tag > |
using | const_reverse_iterator = const reverse_iterator |
Public Member Functions | |
template<typename I > | |
splay_tree (const I b, const I e) | |
constructs tree from elements between two iterators More... | |
splay_tree (splay_tree &&splay)=default | |
constructor | |
splay_tree & | operator= (splay_tree &&splay)=default |
operator= | |
splay_tree & | operator= (splay_tree &splay) |
operator= | |
splay_tree (const splay_tree &splay) | |
constructor | |
template<typename A > | |
splay_tree (const A &array) | |
creates tree from elements in std::vector More... | |
iterator | begin () const |
iterator | end () const |
reverse_iterator | rbegin () |
reverse_iterator | rend () |
std::size_t | size () const |
bool | empty () |
value_type & | operator[] (std::size_t i) const |
std::size_t | get_idx (const T &t) const |
std::size_t | get_rotation_cnt () const |
gets rotationCnt() More... | |
iterator | splay (std::size_t i) const |
splays tree according to splay policy More... | |
splay_tree | split_higher (std::size_t i) |
splits sequence, modified this contains elements {0, ..., i} More... | |
splay_tree | split_lower (std::size_t i) |
splits sequence, modified this contains elements {i, ...} More... | |
void | merge_right (splay_tree other) |
merges given tree to the right of the biggest element of this More... | |
void | merge_left (splay_tree other) |
merges given tree to the left of the smallest element of this More... | |
void | reverse (std::size_t i, std::size_t j) |
reverses subsequence of elements with indices in {i, ..., j} More... | |
detail
Splay trees with logarithmic reversing of any subsequence.
All tree operations are amortized logarithmic time in size of tree, each element is indexed by number of smaller elements than this element. Note that lookups are also amortized logarithmic in size of tree. Order of elements is induced from infix ordering of nodes storing these elements.
Definition at line 31 of file splay_tree.hpp.
|
inline |
constructs tree from elements between two iterators
b | iterator to first element |
e | iterator to element after last |
Definition at line 351 of file splay_tree.hpp.
|
inlineexplicit |
creates tree from elements in std::vector
array | vector container |
Definition at line 383 of file splay_tree.hpp.
|
inline |
Definition at line 388 of file splay_tree.hpp.
|
inline |
Definition at line 411 of file splay_tree.hpp.
|
inline |
Definition at line 395 of file splay_tree.hpp.
|
inline |
t | referenced element |
Definition at line 417 of file splay_tree.hpp.
|
inline |
|
inline |
merges given tree to the left of the smallest element of this
other | tree to be merged |
Definition at line 476 of file splay_tree.hpp.
|
inline |
merges given tree to the right of the biggest element of this
other | tree to be merged |
Definition at line 470 of file splay_tree.hpp.
|
inline |
i | index of referenced element |
Definition at line 414 of file splay_tree.hpp.
|
inline |
Definition at line 398 of file splay_tree.hpp.
|
inline |
Definition at line 405 of file splay_tree.hpp.
|
inline |
reverses subsequence of elements with indices in {i, ..., j}
i | index of first element of subsequence |
j | index of last element of subsequence |
Definition at line 483 of file splay_tree.hpp.
|
inline |
Definition at line 408 of file splay_tree.hpp.
|
inline |
splays tree according to splay policy
i | index of element to become root |
Definition at line 447 of file splay_tree.hpp.
|
inline |
splits sequence, modified this contains elements {0, ..., i}
i | index of last element of this after modification |
Definition at line 457 of file splay_tree.hpp.
|
inline |
splits sequence, modified this contains elements {i, ...}
i | index of first element of this after modification |
Definition at line 464 of file splay_tree.hpp.