当前位置:网站首页>Definition and basic terms of tree
Definition and basic terms of tree
2022-06-09 02:57:00 【Short section senior】
The basic concept of tree
Trees : yes n(n≥0) A finite set of nodes T. In any non-empty tree :
① There is and there is only one particular node , It's called the root of the tree (root), It doesn't have a direct precursor , But there are zero or more direct successors .
② rest n-1 Nodes can be divided into m(m≥0) A finite set that doesn't intersect each other T1,T2,…Tm, among Ti Another tree , A subtree called a root . The definition of a tree is recursive , namely “ There are trees in the trees ”.
Diagram of the logical structure of the tree : Like an inverted tree 
A graphical representation of a tree
① Inverted tree structure representation ( Tree representation )
② Venn diagram representation ( Nested set representation )
③ Generalized table representation ( Nested bracket notation )
(A(B(E(K,L),F),C(G),D(H(M),I,J)))
④ Indentation notation 
Tree related terms
node : That is, the elements in the tree , Contains its own information and branch information pointing to other nodes .
The degree of node : The number of the node tree .
The degree of a tree : The maximum degree of all nodes in the tree .
leaf node : Degree is 0 The node of , Terminal node , Leaf node for short 、 leaf .
Branching nodes : The degree is not for 0 The node of , That is, non terminal nodes .
The hierarchy of nodes : We start at the root , The level of the root node is 1, The immediate successor level of the root is 2, And so on .
The height of the tree ( depth ): The maximum value of the hierarchy of all nodes in the tree .
children : Direct successor node .
Parents : Direct precursor node .
brother : Nodes with the same parents .
male cousins : Nodes of the same layer that are not siblings .
The ancestors : All nodes on the path from the root to the node .
descendants : Direct and indirect successor nodes .
predecessors : A node with a layer number smaller than this node .
Junior : Nodes with a layer number larger than this node .
Ordered trees : In the tree T in , If each subtree Ti In order of precedence , It's called an ordered tree .
isomorphism : For two trees , By renaming the node appropriately , You can make the two trees exactly equal ( The nodes correspond to each other , The correlation of corresponding nodes is also equal ).
example : have 3 Ordered trees with different nodes have a total of 5 Kind of :
The forest : m(m≥0) A collection of disjoint trees . Delete the root node of a non empty tree , The tree becomes a forest ; conversely , Add a unified root node to the forest , The forest becomes a tree .
Abstract data type definition of tree
ADT Tree{
Data objects : Element set D, Element properties are the same .
Data relation : if D It's empty , Empty tree ; if D Contains only one element , be R It's empty ; otherwise R={
H}, Binary relationship H={
< node , children >,...,< node , children >}, Root node root There is no precursor , Other nodes have only one precursor , Subsequent nodes can have zero or more .
Basic operation : On the set of tree operations .
}ADT Tree;
D = { A,B,C,D,E,F,G,H,I,J,K,L,M }
R = { H }
H = { <A,B>,<A,C>,<A,D>,<B,E>, <B,F>,
<E,K>,<E,L>,<C,G>, <D,H>,<D,I>,<D,J>,
<H,M> }
Welcome to join me for wechat exchange and discussion ( Please note csdn Add )
边栏推荐
- Self implemented web server
- Go技術日報(2022-06-07)——go程序員開發效率神器匯總
- Go技术日报(2022-06-07)——go程序员开发效率神器汇总
- Ccf-csp 202104-1 gray histogram 100 points
- Basic method of missing data filling (1) -- k-nearest neighbors (KNN) filling
- InfoQ geek media's 15th anniversary solicitation | one minute Automated Deployment Based on ECs [elastic ECS]
- Leetcode 1310. Subarray XOR query prefix and + XOR
- Datetimeformatter date formatting and parsing
- Sorting out the soft and hard decoding methods of ffmpeg
- PostgreSQL judge the master-slave relationship of the database
猜你喜欢

Deux facteurs importants affectant la défaillance de togglerowselection ()

Leetcode 1442. Triple number prefix and + XOR forming two XOR equal arrays

Leetcode 1352. Product of the last K numbers

Jsnpp框架的全链式语法初探

Leetcode 713. Subarray double pointers whose product is less than k

Go Technology Daily (2022 - 06 - 07) - go programer Development Efficiency God Summary

FPGA初次尝试

Ccf-csp 202104-1 gray histogram 100 points

How does JVM handle exceptions? The principle that finally blocks must execute?

Tiflash source code reading (III) design and implementation analysis of tiflash deltatree storage engine - Part 1
随机推荐
Linux MySQL installation tutorial (Graphic tutorial)
Ccf-csp 201409-3 string matching
Ccp-csp 201909-3 character drawing 100
C# 流程控制语句
Datetimeformatter date formatting and parsing
LeetCode 1155. 掷骰子的N种方法**
Ccp-csp 201912-5 magic number violence 25
The difference between new and newinstance() for creating objects
Ccf-csp 202006-3 markdown renderer 60
How to apply for compulsory redemption of closed financial products?
Leetcode 1310. Subarray XOR query prefix and + XOR
Embedded related open source projects, libraries and materials
Ccf-csp 201903-4 messaging interface
关于JS console.log() 是同步 or 异步引发的问题
Ccf-csp 201909-4 recommended system 100 points
C# 基础篇
Ccf-csp 201903-1 small, medium and large
Ccf-csp 201903-2 24:00
How does JVM handle exceptions? The principle that finally blocks must execute?
Greedy method / non 01 knapsack problem