A tree is a recursive data type that consists of nodes, each of which may have some number of "child nodes", or children, which are themselves nodes of the tree.
Each node has at most one parent, and the tree contains one node that has no parents, called the root of the tree.
Nodes that have no children are also called leaves.
Each node can be treated as the root of a subtree starting with that node, ignoring its parent and any further ancestors.
When drawing a tree, we usually put the root on top, and the tree grows downwards.
The following is a picture of a tree with a root node with two children.
The first child only has one other child, while the second one has two more.
As the saying goes, this happened because computer scientists rarely go outside.
Trees are one of the most fundamental data structures in computer science.
You will encounter them everywhere.
There is a large variety of potential tree data structures.
Some have very rigid structures, where every node must either be a leaf or have the same number of children.
Others allow nodes to have any number of children between some minimum or maximum.
Some trees draw strict distinctions between leaves and inner nodes - oftentimes the distinction is that only one of them carries data.
Some trees are formed by children knowing (pointing at) their parents, some trees are formed by parents knowing (point at) their children, in some trees, you can go in either direction.