Terminology
Let's consider some terms associated with trees.
To understand trees, we need to first understand the basic ideas on which they rest. The following figure contains a typical tree consisting of character nodes lettered A through to M.
Here is a list of terms associated with a Tree:
- Node: Each circled alphabet represents a node. A node is any structure that holds data.
- Root node: The root node is the only node from which all other nodes come. A tree with an undistinguishable root node cannot be considered as a tree. The root node in our tree is the node A.
- Sub-tree: A sub-tree of a tree is a tree with its nodes being a descendant of some other tree. Nodes F, K, and L form a sub-tree of the original tree consisting of all the nodes.
- Degree: The number of sub-trees of a given node. A tree consisting of only one node has a degree of 0. This one tree node is also considered as a tree by all standards. The degree of node A is 2.
- Leaf node: This is a node with a degree of 0. Nodes J, E, K,...