Tree::GetNextTreeNode
Defined in:
Returns the next node in a traversal of a tree.
TSTree.h
Prototype
type *GetNextTreeNode(const Tree<type> *node) const;
Parameters
node |
A pointer to the current node in the traversal. |
Description
To iterate forward through the subnode hierarchy of a tree, the GetNextTreeNode
function should be repeatedly called for the root node of the tree until it returns nullptr
. The root node is considered the first node visited in the tree. The second node is obtained by calling GetNextTreeNode
with the node
parameter set to a pointer to the root node. The traversal occurs in depth-first order, meaning that a particular node's entire subtree is visited before the next node at the same level in the tree. The traversal is also a pre-order traversal, meaning that a particular node is visited before any of its subnodes are visited.
See Also