1. Tree
A tree is a finite set T of one or more nodes, which makes:
A) There is a specially specified node, called the root of the tree (T), and:
b) The remaining nodes (excluding the root) are divided $m \geq 0$ disjoint set $t_1, ..., t_m$, and each of these sets is also a tree. Tree $t_1, ..., t_m$ called a subtree of this root.
2. degree
The number of sub-trees of a node is called the degree of that node.
Nodes with a degree of 0 are called end (end) nodes, or sometimes called leaves.
A non-final node is usually called a branch node.
As opposed to T, the level of a node is recursively defined as:
The root (t) level is 0, and the level of any other node is greater than 1 for the corresponding node of the subtree that contains the root (t) of the node.
3. Ordered Tree
If the relative order of the subtree $t_1, ..., t_m$ in definition B) is important, we say that the tree is an ordered tree;
If you treat two trees that are not just the relative order of the node tree as different trees, it is said that such trees are directed because they are only considering the relative direction of the nodes, not their order.
Unless explicitly stated, all the trees discussed in this book are orderly.
4. Forest
A forest is a collection of 0 or more disjoint trees (usually an ordered collection). Another way to express the definition of Part B) is to say that all nodes except the root of the tree form the forest.
The difference between the abstract tree and the forest is very small. If we delete the root of the tree, we have a forest; Conversely, if you add a node to any forest and take the tree in the forest as a subtree of the new node, we get a tree. Thus, in informal discussions about data structures, trees and forests are usually almost interchangeable.
5. Two fork Tree
A tree of up to two subtrees per node, called a binary tree, and when there is only one subtrees tree, we distinguish the Saozi right subtree. To say more formally:
A binary tree is an ordered set of nodes, either empty or composed of two elements of a disjoint two-tree that are called left and right subtrees by the root of root and.
Note: Two the fork tree is not a special case of a tree; it is a completely different concept: Two The tree can be empty, but the tree cannot.
Taocp_2.3_ Tree