Definitions and terminology of trees

Source: Internet
Author: User

Definitions and terminology of trees

Flyfish 2015-7-9

A tree is a finite set of n (n>=0) nodes. N=0 is called an empty tree. in any one of the non-empty trees:

1) There is only one specific node called root (Root)

2) When n>1, the remaining nodes can be divided into m (m>0) non-intersecting finite sets. T 1 、 T 2 、...、 T m , each of which is itself a tree, and a subtree called the root (subtree)

a tree's nodes contain a data element and several branches that point to its subtree.

The number of sub-trees owned by a node is called the degree of the node.

A node with a degree of 0 is called a leaf node or terminal node, and a node with a degree of 0 is called a non-terminal node or branch node.

Root nodes, branch nodes are also called internal nodes.

The degree of the tree is the maximum of the degree of each node within the tree.

The root of the node's subtree is called the child of the node. Accordingly, the node is called the child's parents.

The children of the same parent are called Brothers (Sibling).

The ancestor of a node (Ancestor) is all the nodes from the root to the branch of the node.

Node hierarchy: the level of the node is defined from the root, the root is the first layer, and the child of the root is the second layer. If a node is in the L layer, the root of its subtree is on the l+1 layer. Their parents are cousins on the same level of the knot.

The maximum level of nodes in a tree is called the depth or height of the tree (Depth).

If the subtree of the nodes in the tree is considered to be sequential from left to right and cannot be interchanged, the tree is called an ordered tree, otherwise it is called an unordered tree.

The forest is a collection of M (m>=0) trees that are disjoint from each other. For each node in the tree, the collection of its subtrees is the forest.

Quote from "Big talk data Structure"

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Definitions and terminology of trees

Related Article

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.