The number of nodes in this tree or subtree.
The index of this node.
Returns whether the tree or subtree is empty.
The "left" subtree.
The value of the node containing the maximum value
The index of the node containing the maximum value within the subtree.
The value of the node containing the minimum value
The "right" subtree.
Converts the tree to a list.
The value associated with this node.
Abstract binary tree definition that defines the methods and properties of each node in the tree: regular nodes are implemented by the class Node, while empty nodes (indicating that their parent is a terminal node) are implemented by the singleton object EmptyTree.
Implemented by the class Node and the object EmptyTree. A binary tree for a set of numbers (Doubles) is constructed by first obtaining an ordered (but unconnected) list of Node instances using the function Tree.buildOrderedNodeList. The ordered list of Nodes returned by this function can then be passed to the function Tree.buildTree to return an instance of Tree containing the binary tree.