"Third week of data structure" tree knowledge point finishing (top)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.