The Tree ADT stores elements at positions which are defined relative to neighbouring positions.
A tree also similarly provides a Position with the method element() which returns the object stored at the position.
Accessor methods:
position root(): return the tree’s root; error occurs if tree is emptyposition parent(v): return the parent of ; error occurs if is rootIterable children(v): returns an iterable collection containing the children of node
Query methods:
boolean isInternal(v): test whether node is internalboolean isExternal(v): test whether node is externalboolean isRoot(v): test whether node is a root
Generic methods:
integer size(): return the number of nodes in the treeboolean isEmpty(): test whether the tree has any nodesIterator iterator(): return an iterator of nodes stored in treeIterable positions(): return iterable collection of all nodes in treeelement replace(v, e): replace element stored at with and return it