Inherits ReferenceCountedObject.
◆ BinaryTreeImpl() [1/3]
template<class TYPE >
BinaryTree< TYPE >::BinaryTreeImpl::BinaryTreeImpl |
( |
| ) |
|
|
inlineexplicitnoexcept |
Initialize an empty binary tree.
◆ BinaryTreeImpl() [2/3]
Initialize a binary tree with the specified root node.
- Parameters
-
node | The root node of the tree. |
◆ BinaryTreeImpl() [3/3]
Initialize binary tree from other binary tree.
◆ ~BinaryTreeImpl()
template<class TYPE >
BinaryTree< TYPE >::BinaryTreeImpl::~BinaryTreeImpl |
( |
| ) |
|
|
inline |
Destroys the binary tree.
◆ balanceTree()
template<class TYPE >
void BinaryTree< TYPE >::BinaryTreeImpl::balanceTree |
( |
| ) |
|
|
inline |
Builds a balanced tree. But uses buffer and rebuilds entire tree.
◆ buildBalancedTree()
◆ copySubtree()
Makes a copy of a subtree specified by the top node.
- Parameters
-
node | The top node of the subtree to be copied. |
- Returns
- The top node of the new subtree.
◆ destroySubtree()
template<class TYPE >
void BinaryTree< TYPE >::BinaryTreeImpl::destroySubtree |
( |
Node * |
node | ) |
|
|
inlineprotected |
Destroys the subtree specified by the node. Helper function only used by the destouctor.
- Parameters
-
node | The root node of the subtree to be destroyed. |
◆ getHowBalanced()
template<class TYPE >
static Pair<MemorySize, MemorySize> BinaryTree< TYPE >::BinaryTreeImpl::getHowBalanced |
( |
const Node * |
node | ) |
|
|
inlinestatic |
Returns how balanced the given tree is.
◆ getHowBalancedImpl()
template<class TYPE >
static Pair<MemorySize, MemorySize> BinaryTree< TYPE >::BinaryTreeImpl::getHowBalancedImpl |
( |
const Node * |
node | ) |
|
|
inlinestatic |
Returns how balanced the given tree is.
◆ getNodes()
Gets all the nodes for the given node.
◆ getRoot() [1/2]
Returns the root node of the binary tree.
◆ getRoot() [2/2]
Returns the root node of the binary tree.
◆ getSize()
template<class TYPE >
static MemorySize BinaryTree< TYPE >::BinaryTreeImpl::getSize |
( |
const Node * |
node | ) |
|
|
inlinestaticnoexcept |
Returns the size of the given subtree.
◆ isBalanced()
template<class TYPE >
static bool BinaryTree< TYPE >::BinaryTreeImpl::isBalanced |
( |
const Node * |
node | ) |
|
|
inlinestaticnoexcept |
Returns true if the tree is balanced.
◆ isEmpty()
template<class TYPE >
bool BinaryTree< TYPE >::BinaryTreeImpl::isEmpty |
( |
| ) |
const |
|
inlinenoexcept |
Returns true if the binary tree is empty.
◆ makeLeft() [1/2]
template<class TYPE >
static Node* BinaryTree< TYPE >::BinaryTreeImpl::makeLeft |
( |
Node * |
node, |
|
|
const TYPE & |
value |
|
) |
| |
|
inlinestatic |
Makes a left child node.
- Returns
- The new left child node.
◆ makeLeft() [2/2]
Makes a left child node.
- Returns
- The new left child node.
◆ makeRight() [1/2]
template<class TYPE >
static Node* BinaryTree< TYPE >::BinaryTreeImpl::makeRight |
( |
Node * |
node, |
|
|
const TYPE & |
value |
|
) |
| |
|
inlinestatic |
Makes a right child node.
- Returns
- The new right child node.
◆ makeRight() [2/2]
Makes a right child node.
- Returns
- The new right child node.
◆ rotateLeft()
Rotates the specified subtree to the left. Raises InvalidNode if the specified node cannot be rotated (i.e. the specified node does not have a right child node).
- Parameters
-
node | The subtree to be rotated. |
- Returns
- The new parent of the subtree.
◆ rotateRight()
Rotates the specified subtree to the right. Raises InvalidNode if the specified node cannot be rotated (i.e. the specified node does not have a left child node).
- Parameters
-
node | The subtree to be rotated. |
- Returns
- The new parent of the subtree.
◆ setRoot()
Sets the root of the binary tree.
◆ validate()
template<class TYPE >
template<class PREDICATE >
static bool BinaryTree< TYPE >::BinaryTreeImpl::validate |
( |
const Node * |
node, |
|
|
PREDICATE |
predicate |
|
) |
| |
|
inlinestatic |
Validates the tree for the given predicate.