"Data Structure" review notes--Tree

Source: Internet
Author: User

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:

    1. node degree : The number of sub-trees that a node contains is called the degree of the node;
    2. degree of the tree: the degree of the largest node in a tree is called the degree of the tree;
    3. leaf node or end node : A zero-degree node;
    4. non-terminal node or branch node : A node with a degree nonzero;
    5. Father node or parent node : If a node contains child nodes, this node is called the parent node of its child nodes;
    6. child node or child node : The root node of a subtree containing a node is called a child node of that node;
    7. sibling nodes : nodes with the same parent node are called sibling nodes;
    8. 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;
    9. The height or depth of a tree: the maximum level of nodes in a tree;
    10. cousin Node : The parent node in the same layer of the nodes are each other cousins;
    11. ancestor of a node : All nodes from the root to the branch of the node;
    12. descendants : Any node in a subtree that is rooted in a node is known as the descendant of that node.
    13. Forest : The collection of trees that are disjoint by M (m>=0) is called a forest;



"Data Structure" review notes--Tree

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.