Tree:
Wikipedia:
A tree graph is a data structure that consists of n (n>=1) finite nodes that form a hierarchical set of relationships. It's called a "tree" because it looks like an upside down tree, which means it's rooted up and leaves facing down. It has the following characteristics:
- Each node has 0 or more child nodes;
- A node without a parent node is called the root node;
- Each non-root node has only one parent node;
- In addition to the root node, each child node can be divided into multiple disjoint subtrees;
According to your own understanding: a non-direction, non-ring, v vertex corresponding to the V-1 bar edge of the graph.
Some basic terms of the tree:
- node degree : The number of sub-trees that a node contains is called the degree of the node;
- degree of the tree: the degree of the largest node in a tree is called the degree of the tree;
- leaf node or end node : A zero-degree node;
- non-terminal node or branch node : A node with a degree nonzero;
- Father node or parent node : If a node contains child nodes, this node is called the parent node of its child nodes;
- child node or child node : The root node of a subtree containing a node is called a child node of that node;
- sibling nodes : nodes with the same parent node are called sibling nodes;
- The hierarchy of nodes: From the beginning of the root definition, the root is the 1th layer, the root of the child node is the 2nd layer, and so on;
- The height or depth of a tree: the maximum level of nodes in a tree;
- cousin Node : The parent node in the same layer of the nodes are each other cousins;
- ancestor of a node : All nodes from the root to the branch of the node;
- descendants : Any node in a subtree that is rooted in a node is known as the descendant of that node.
- Forest : The collection of trees that are disjoint by M (m>=0) is called a forest;
"Data Structure" review notes--Tree