1, the definition of the tree
Tree: A finite set of n (n>=0) nodes
Sub-trees are disjoint.
In addition to the root node, each node has and has only one parent node.
A tree of N nodes has a N-1 edge.
2. Some basic terms of the tree
(1) node degree (degree): Number of sub-trees of nodes
(2) The degree of the tree: the maximum number of degrees in all nodes of the tree
(3) Leaf junction (leaf): nodes with a degree of 0
(4) Parent node: A node with a subtree is the parent node of the root node of its child tree
(5) Sub-node (child): If the A node is the parent node of the b node, then the B node is the Sub-node of Node A.
(6) Sibling node (Sibling): Each node with the same parent node is a sibling node.
(7) path and path length: The path from node N1 to NK is a node sequence. The number of edges that the path contains is the length of the path
(8) Ancestor node (Ancestor): All nodes along the tree root to a node path are the ancestor nodes of this node.
(9) Descendants node (descendant): All nodes in a subtree of a node are descendants of this node
(10) node hierarchy (level): Specifies that the root node is at 1 levels, and that the number of layers of any other node is the layer of its parent and 1
(11) Depth of tree (Depth): The maximum level of all nodes in the tree is the depth of this tree
3. Binary tree and storage structure
(1) Definition
A binary tree is an ordered tree with a maximum of two subtrees per node.
Specific five basic forms
Special two-fork tree
(2) Several important properties of binary tree
(2) Sequential storage structure of binary tree
A typical two-fork tree is a waste of space if stored in this way.
(3) Chain storage structure of binary tree
"Third week of data structure" tree knowledge point finishing (top)