Tree data structure (1)

Tree of related concepts;

Root: There is a particular node is called the root node or the root (root)

Nodes: Each node element called (node)

Side: the side and the side

As shown below:

 

 

Empty set is the tree, called the empty tree. No empty tree nodes.
Of the node: a node number contained in the sub-node is called the node degree;
Leaf node or a terminal node: node 0 degree is referred to as leaf nodes;
 
Parent parent node or a node: If a node comprising a child node, this node is called a parent node to its child nodes;
Child node or child nodes: the root subtree comprising a node is called a child node of the node;
Sibling nodes: node having the same parent node is referred to as a cross-sibling;
Of the tree: a tree, the nodes of the maximum level of the tree is called;
Level nodes: Start from the root from the definition, the root of the first layer, the sub-root node as the second layer, and so on;
The height or depth of the tree: the tree nodes of the maximum level point;
Forest: a set of m (m> = 0) disjoint trees called forest trees;

 

Binary tree:

Binary tree each node has at most two sub-trees tree structure. Subtree generally referred to as "left subtree" (left subtree), and "right subtree" (right subtree). Binary tree is often used to implement a binary search tree and a binary heap.

 

 Binary tree type:

(1) complete binary tree: When the height h is set to a binary tree, except the h layer, the other layers (1 ~ h-1) has reached the maximum number of nodes, the h layer leaf nodes , and leaf nodes points are arranged from left to right, this is the complete binary tree .
(2) a full binary tree: cotyledons are left in addition to a leaf node of each node and leaf nodes are at the lowest level of the binary tree.
(3) balanced binary tree: also known as an AVL tree, which is a binary sort tree, and has the following properties: it is an absolute value of an empty tree or a left and right subtrees height difference does not exceed 1, and the left and right sub-trees are a balanced binary tree .

 

 K is a complete binary tree depth of at least 2 k-th leaf node. 1, at most 2 k-knot. 1

A depth of k, the binary tree with 2 ^ k-1 nodes, called full binary tree

 

Guess you like

Origin www.cnblogs.com/topass123/p/12652675.html