Template Class ArrayBinaryTree
Defined in File ArrayBinaryTree.h
Nested Relationships
Nested Types
Class Documentation
-
template<class T>
class ArrayBinaryTree a binary tree in a positional vector
Public Functions
-
ArrayBinaryTree(void) = default
the empty tree
-
ArrayBinaryTree(const T &v, const ArrayBinaryTree &l, const ArrayBinaryTree &r)
a new root of value v with copies of l and r as its subtrees
-
bool empty(void) const
-
long root(void) const
the root, NIL if the tree is empty
-
long parent(long i) const
the parent of i, NIL for the root
- Pre:
i is a node
-
long left(long i) const
the left child of i, NIL if there is none
- Pre:
i is a node
-
long right(long i) const
the right child of i, NIL if there is none
- Pre:
i is a node
-
bool isLeaf(long i) const
- Pre:
i is a node
-
void insertLeft(long i, const ArrayBinaryTree &t)
a copy of t as the left subtree of i, which must be missing; t may be this tree, copied as it was before the call
-
void insertRight(long i, const ArrayBinaryTree &t)
a copy of t as the right subtree of i, which must be missing; t may be this tree, copied as it was before the call
-
void remove(long i)
empties the subtree of i
-
std::vector<long> preorder(void) const
the places of the nodes in preorder
-
inline auto nodes(void) const
the nodes, in the order of their places, bidirectional
Public Static Attributes
-
static constexpr long NIL = -1
-
struct Used
the places in use, for SlotIterator
-
ArrayBinaryTree(void) = default