Tree (data structure)

Abstract data type simulating a hierarchical tree structure and represented as a set of linked nodes
This unsorted tree has non-unique values and is non-binary, because the number of children varies from one (e.g. node 9) to three (node 7). The root node, at the top, has no parent.

Trees are commonly used to represent or manipulate hierarchical data in applications such as:

Trees can be used to represent and manipulate various mathematical structures, such as:

Tree structures are often used for mapping the relationships between things, such as:

A node reachable by repeated proceeding from parent to child. Also known as subchild.
For a given node, its number of children. A leaf has necessarily degree zero.
Not a tree: undirected cycle 1-2-4-3. 4 has more than one parent (inbound edge).
Not a tree: cycle B→C→E→D→B. B has more than one parent (inbound edge).

Viewed as a whole, a tree data structure is an ordered tree, generally with values attached to each node. Concretely, it is (if required to be non-empty):