|
Node * | get_first_equal (Node *n) noexcept |
|
Node * | get_smallest () const noexcept |
|
Node * | get_largest () const noexcept |
|
Node * | get_uncle (Node *node) const noexcept |
|
template<class NodeNameGetter > |
void | dump_to_dot_base (const std::string &filename, NodeNameGetter name_getter) const |
|
template<class NodeNameGetter > |
void | output_node_base (const Node *node, std::ofstream &out, NodeNameGetter name_getter) const |
|
template<class Node, class Options, class Tag = int, class Compare = ygg::utilities::flexible_less, class ParentContainer = DefaultParentContainer<Node>>
Create a new red-black tree from a different red-black tree.
The other red-black tree is moved into this one, i.e., using it afterwards is undefined behavior.
- Parameters
-
other | The red-black tree that this one is constructed from |
template<class Node, class Options, class Tag = int, class Compare = ygg::utilities::flexible_less, class ParentContainer = DefaultParentContainer<Node>>
Removes all elements from the tree.
Removes all elements from the tree.
template<class Node, class Options, class Tag = int, class Compare = ygg::utilities::flexible_less, class ParentContainer = DefaultParentContainer<Node>>
template<class NodeTraits >
void ygg::bst::BinarySearchTree< Node, Options, Tag, Compare, ParentContainer >::dump_to_dot |
( |
const std::string & |
filename | ) |
const |
Debugging Method: Draw the Tree as a .dot file.
Outputs the current tree as a .dot file which can be drawn using graphviz.
- Parameters
-
filename | The file path where to write the .dot file. |
template<class Node, class Options, class Tag = int, class Compare = ygg::utilities::flexible_less, class ParentContainer = DefaultParentContainer<Node>>
Returns whether the tree is empty.
This method runs in O(1).
- Returns
- true if the tree is empty, false otherwise
template<class Node, class Options, class Tag = int, class Compare = ygg::utilities::flexible_less, class ParentContainer = DefaultParentContainer<Node>>
template<class Comparable , bool ensure_first = false>
Finds an element in the tree.
Returns an iterator to the first element that compares equally to <query>. Note that <query> does not have to be a Node, but can be anything that can be compared to a Node, i.e., for which Compare()(const Node &, const Comparable &) and Compare()(const Comparable &, const Node &) are defined and implemented. In the case of using the default ygg::utilities::flexible_less as Compare, that means you have to implement operator<() for both types.
- Warning
- Not available for explicitly ordered trees
- Parameters
-
query | An object comparing equally to the element that should be found. |
- Returns
- An iterator to the first element comparing equally to <query>, or end() if no such element exists
template<class Node, class Options, class Tag = int, class Compare = ygg::utilities::flexible_less, class ParentContainer = DefaultParentContainer<Node>>
template<class Comparable >
Lower-bounds an element.
Returns an iterator to the first element that is not less that <query>, i.e., that does not have to go before <query>.
Note that <query> does not have to be a Node, but can be anything that can be compared to a Node, i.e., for which Compare()(const Node &, const Comparable &) and Compare()(const Comparable &, const Node &) are defined and implemented. In the case of using the default ygg::utilities::flexible_less as Compare, that means you have to implement operator<() for both types.
- Warning
- Not available for explicitly ordered trees
- Parameters
-
query | An object comparable to Node that should be lower-bounded |
- Returns
- An iterator to the first element comparing greater-or-equally to <query>, or end() if no such element exists
template<class Node, class Options, class Tag = int, class Compare = ygg::utilities::flexible_less, class ParentContainer = DefaultParentContainer<Node>>
Move-assign an other red-black tree to this one.
The other red-black tree is moved into this one, i.e., using it afterwards is undefined behavior.
- Parameters
-
other | The red-black tree that this one is constructed from |
template<class Node, class Options, class Tag = int, class Compare = ygg::utilities::flexible_less, class ParentContainer = DefaultParentContainer<Node>>
Return the number of elements in the tree.
This method runs in O(1).
- Warning
- This method is only available if CONSTANT_TIME_SIZE is set as option!
- Returns
- The number of elements in the tree.
template<class Node, class Options, class Tag = int, class Compare = ygg::utilities::flexible_less, class ParentContainer = DefaultParentContainer<Node>>
template<class Comparable >
Upper-bounds an element.
Returns an iterator to the smallest element to which <query> compares as "less", i.e. the smallest element that is considered go strictly after <query>.
Note that <query> does not have to be a Node, but can be anything that can be compared to a Node, i.e., for which Compare()(const Node &, const Comparable &) and Compare()(const Comparable &, const Node &) are defined and implemented. In the case of using the default ygg::utilities::flexible_less as Compare, that means you have to implement operator<() for both types.
- Warning
- Not available for explicitly ordered trees
- Parameters
-
query | An object comparable to Node that should be upper-bounded |
- Returns
- An iterator to the first element comparing "greater" to <query>, or end() if no such element exists