#include <tpl_binTree.H>
|
|
using | Base = GenBinTree< BinNodeVtl, Key, Compare > |
| |
|
using | Node = BinNodeVtl< Key > |
| |
template<typename Key, class Compare = Aleph::less<Key>>
struct Aleph::BinTreeVtl< Key, Compare >
Binary search tree with nodes with virtual destructors,
- See also
- GenBinTree BinTreeVtl DynBinTree
◆ get_compare()
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
◆ insert()
Insert a node in the tree
- Parameters
-
| [in] | p | pointer to the node to insert |
- Returns
- if
p->get_key() is not in the tree, then the pointer p is returned (it was inserted); othewise, nullptr is returned
◆ insert_dup()
Insert a node in the tree.
This method does not fail. It always inserts.
- Parameters
-
| [in] | p | pointer to the node to insert |
- Returns
- the
p pointer
◆ join()
Join tree with this. Duplicated keys of tree are put in dup parameter.
- Parameters
-
| [in,out] | tree | to join with this |
| [out] | dup | tree where the duplicated key belonging to tree are put. |
◆ join_dup()
Join this with t independently of the presence of duplicated keys
join(t) produces a random tree result of join of this and t. The resulting tree is stored in this.
- Parameters
-
| [in] | t | tree to join with this keys are inserted |
◆ join_exclusive()
Join exclusive of this with t
Exclusive means that all the keys of this are lesser than all the keys of t. This knowlege allows a more effcient way for joining that when the keys ranks are overlapped. However, use very carefully because the algorithm does not perform any check and the result would be incorrect.
- Parameters
-
| [in] | t | tree to exclusively join with this keys are inserted |
◆ remove()
Remove a key from the tree
- Parameters
-
- Returns
- a valid pointer to the removed node if
key was found in the tree, nullptr otherwise
◆ search()
| Node* Aleph::GenBinTree< BinNodeVtl , Key, Compare >::search |
( |
const Key & |
key | ) |
const |
|
inlinenoexceptinherited |
Search a key.
- Parameters
-
- Returns
- a pointer to the containing key if this was found; otherwise
nullptr
◆ search_or_insert()
Search or insert a key.
search_or_insert(p) searches in the tree the key KEY(p). If this key is found, then a pointer to the node containing it is returned. Otherwise, p is inserted.
- Parameters
-
| [in] | p | node containing a key to be searched and eventually inserted |
- Returns
- if the key contained in
p is found, then a pointer to the containing key in the tree is returned. Otherwise, p is inserted and returned
◆ split()
Split the tree according to a key
split(key, l, r) splits the tree according to key. That is, if key is not present in the tree, then the tree is split in two trees l which contains the key lesser than key and r which contains the keys greater than key. If key is found in the tree, then the split is not done
- Parameters
-
| [in] | key | for splitting |
| [out] | l | resulting tree with the keys lesser than key |
| [out] | r | resulting tree with the keys greater than key |
- Returns
- true if the tree was split.
false otherwise
◆ split_dup()
Split the tree according to a key that could be in the tree
split_dup(key, l, r) splits the tree according to key in two trees l which contains the key lesser than key and r which contains the keys greater or equal than key.
- Parameters
-
| [in] | key | for splitting |
| [out] | l | resulting tree with the keys lesser than key |
| [out] | r | resulting tree with the keys greater or equal than key |
◆ verifyBin()
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
The documentation for this struct was generated from the following file: