当前位置:网站首页>Definition and basic terms of tree
Definition and basic terms of tree
2022-07-25 04:11:00 【Luish Liu】
Definition and basic terms of tree
The definition of a tree

Start from a node called the root node , Then each branch grows in turn , A new node can be connected to each branch , Branches can be called edges ; The orange node in the figure has branches at the next level , Nodes like this can be called branch nodes ; The green node has no other branches below , It can be called leaf node .
Empty tree
The number of nodes is 0 The tree of , There is no node .
Not empty trees
- There is only one node
- Nodes without successors are called “ leaf node ” ( Or terminal node )
- Nodes with successors are called “ Branching nodes ” ( Or non terminal node )
- Any node except the root node There is and only one Forerunner
- Each node can have 0 One or more successor nodes
subtree

Pictured above A Is the root node , It can be said that this root node has three sub trees , And the three subtrees are disjoint .

The subtree can be regarded as a new tree , Pictured above ,B The node becomes the root node of the tree , This tree can also be divided into two disjoint subtrees , The subtree on the right has only one node , The tree on the right can be regarded as a root node , At the same time, its sub trees are all empty trees .
Therefore, we can see that the tree is a recursively defined data structure , Any tree can be regarded as composed of root nodes and several disjoint subtrees .
Basic terminology
Ancestral node : Starting from a node , Keep going up , Until you reach the root node , All nodes on this path are the ancestors of this node .
Children's node : Starting from a node , The nodes under his branches are all his descendants .
Parents node ( The parent node ): The direct precursor of a node .
Child node : The direct successor of a node .
Brother nodes : These nodes of a father .
Cousin node : Other nodes in the first layer except brother nodes .
route : You can only go in one direction ( From the top down ).
The length of the path : Passed several sides .
Attribute description of nodes and trees
The hierarchy of nodes ( depth ): Count from top to bottom , The default from the 1 Start .
The height of the node : Count from the bottom up
The height of the tree ( depth ): How many floors are there in total
The degree of node : There are several children ( Branch )
The degree of a tree : The maximum value of each node degree
The degree is greater than 0 The node of is the branch node , It can also be called non leaf node ( Non terminal nodes ); Degree is 0 The node of is the leaf node ( Terminal node ).
Ordered trees and unordered trees
Ordered trees : Logically , The subtrees of nodes in the tree are ordered from left to right , Not interchangeable .
Disordered trees : Logically , The subtrees of nodes in the tree are unordered from left to right ( The left and right positions of nodes do not reflect some logical relationships ), interchangeable .
The forest
from M A collection of disjoint trees , If these trees are connected to the same root node , The forest will become a tree .
边栏推荐
- Day008 select structure (switch statement)
- Aggregate payment meets the needs of various industries to access a variety of payments
- MySQL
- What are the models of asemi from the manufacturer of rectifier bridge and how about the electroplating process of the manufacturer of rectifier bridge?
- DNS domain name resolution
- Wechat applet authorized login (including obtaining basic information and binding mobile number)
- Original | record a loophole excavation in Colleges and Universities
- Top101 [linked list] must be applied for interview
- EMQ Yingyun technology was successfully selected into the 2022 "cutting edge 100" list of Chinese entrepreneurs
- Servlet个人实操笔记(一)
猜你喜欢

使用 “display: flex;justify-content: center;align-items: center; ” 解决流式栅格布局无法居中的问题
![[understanding of opportunity-47]: Guiguzi - Chapter 11 - decision makers, moderation, and rational distribution of interests](/img/f1/e95f230e618d4c4b67b2e0a8c8507b.jpg)
[understanding of opportunity-47]: Guiguzi - Chapter 11 - decision makers, moderation, and rational distribution of interests

基于SSM实现后勤报修系统

MySQL select query part 2

C language: string processing function

Modbus poll/slave simulator tutorial

How to test cookies

Digital collections can go further without hype

Openharmony Mengxin contribution Guide

Skywalking distributed link tracking, related graphics, DLJD, cat
随机推荐
Internship in 2022
The difference between apply, call and bind
Spirng security (VIII) multiple filter chains coexist
Function and technical principle of data desensitization [detailed explanation]
DNS domain name resolution service
Which stock exchange has the lowest commission? Is online account manager safe to open an account
[Flink] protocol operator reduce
Which securities company do retail investors choose for stock speculation? Is it safe to open an account on your mobile phone
ES(8.1)认证题目
Implementation of logistics repair reporting system based on SSM
Deeply understand the connection state and reliable mechanism of TCP protocol
High temperature in Britain: two airport runways were burnt out, and several railways were restricted to ensure safety
RGB and SATA function switching module based on Quanzhi rk3568j
Postgraduate entrance examination experience
01_ Education 1
Servlet personal practice notes (I)
301. Delete invalid brackets
Localization distillation for dense object detection cvpr2022
[Flink] rich function
Solve "nothing added to commit but untracked files present"“