Represents a tree data structure.
The type of data stored in the tree.
Creates a new tree with the specified data as the root node.
The data to be stored in the root node.
The root node of the tree.
Gets the depth of the tree.
The depth of the tree.
Searches the tree for a node with the specified data and returns the node if found.
The data to search for.
The node with the specified data, or undefined if not found.
Traverses the tree in the specified order and returns an array of the visited nodes' data.
The order in which to traverse the tree. Defaults to "pre".
An array of the visited nodes' data.
Represents a tree data structure.