当前位置:网站首页>Basic knowledge of tree and binary tree (detailed illustration)
Basic knowledge of tree and binary tree (detailed illustration)
2022-07-02 21:28:00 【S dream chasing boy】
One 、 Trees
(1) Trees ( Tree ) yes n ( n >0) A finite set of nodes . n =0 Time is called empty tree . In any non-empty tree : There is and only one specific one called a root ( Root ) The node of ;
(2) When n >1 when , The rest of the nodes can be divided into m ( m >0) A finite set that doesn't intersect each other T 、T2、…………、 Tm , Each set itself is a tree , And called the root of the subtree ( SubTree ), As shown in the figure below .

Two 、 The node of the tree
(1) The number of subtrees a node has is called the degree of the node (Degree).
(2) Degree is 0 The nodes of are called leaf nodes (Leaf) Or terminal node ;
(3) The degree is not for 0 The nodes of are called non terminal nodes or branch nodes .
(4) Except for the root node , Branch nodes also become internal nodes .
(5) The degree of a tree is the maximum value of the degree of each node in the tree .

3、 ... and 、 The relationship between nodes
(1) The root of a node's subtree is called the child of the node (Child), Accordingly , This node is called the parents of children (Parent).
(2) Children of the same parents call each other brothers (Sibling). The ancestor of a node is all nodes from the root to the branch it passes through .
(3) Any node in a subtree with a node as its root is called the descendant of the node .

Four 、 Layer and depth of tree
(1) The hierarchy of nodes (Level) Define from the root node , The root is the first layer , The child of root is the second layer .
(2) If a node is at i layer , Then the root of its subtree is i+1 layer .
(3) Their parents are cousins at the same level .
(4) Of nodes in a tree The biggest level Called the depth of the tree (Depth) Or height .
5、 ... and 、 Binary tree
Binary tree (Binary) yes n(n≥0) A finite set of nodes , It has at most two subtrees per node . It may be an empty set , Or it is composed of a root node and two disjoint binary trees called the left subtree and the right subtree of this root respectively .

6、 ... and 、 Five basic forms of binary trees
(1) Empty binary tree ( There is no node )
(2) There is only one root node
(3) The root node has only the left subtree

(4) The root node has only right subtrees

(5) The root node has both left and right subtrees

7、 ... and 、 The special form of binary tree
(1) Oblique tree

(2) Full binary tree

(3) Perfect binary tree

8、 ... and 、 Properties of binary trees

边栏推荐
- Market trend report, technical dynamic innovation and market forecast of China's low gloss instrument
- Research Report on ranking analysis and investment strategic planning of RFID market competitiveness of China's industrial manufacturing 2022-2028 Edition
- Construction and maintenance of business websites [6]
- I want to ask you, where is a better place to open an account in Dongguan? Is it safe to open a mobile account?
- JS modularization
- Structured text language XML
- Activation function - relu vs sigmoid
- Construction and maintenance of business websites [10]
- Research Report on the overall scale, major manufacturers, major regions, products and applications of capacitive voltage transformers in the global market in 2022
- Construction and maintenance of business websites [7]
猜你喜欢

Check the confession items of 6 yyds

Internal/validators js:124 throw new ERR_ INVALID_ ARG_ Type (name, 'string', value) -- solution

Unexpectedly, there are such sand sculpture code comments! I laughed

rwctf2022_ QLaaS

7. Build native development environment

AMD's largest transaction ever, the successful acquisition of Xilinx with us $35billion

Review of the latest 2022 research on "deep learning methods for industrial defect detection"

Friends who firmly believe that human memory is stored in macromolecular substances, please take a look

Investment strategy analysis of China's electronic information manufacturing industry and forecast report on the demand outlook of the 14th five year plan 2022-2028 Edition
![[fluent] dart technique (independent main function entry | nullable type determination | default value setting)](/img/cc/3e4ff5cb2237c0f2007c61db1c346d.jpg)
[fluent] dart technique (independent main function entry | nullable type determination | default value setting)
随机推荐
Research Report on market supply and demand and strategy of China's plastic trunking industry
Common authority query instructions in Oracle
mysql
China's crude oil heater market trend report, technological innovation and market forecast
Research Report on the overall scale, major manufacturers, major regions, products and applications of capacitive voltage transformers in the global market in 2022
I want to ask you, where is a better place to open an account in Dongguan? Is it safe to open a mobile account?
Research Report on micro gripper industry - market status analysis and development prospect prediction
Research Report on the overall scale, major manufacturers, major regions, products and applications of building automation power meters in the global market in 2022
5 environment construction spark on yarn
Is it safe to buy funds on securities accounts? Where can I buy funds
Makefile: usage of control functions (error, warning, info)
1005 spell it right (20 points) "PTA class a exercise"
What are the preferential account opening policies of securities companies now? Is it actually safe to open an account online?
I would like to ask what securities dealers recommend? Is it safe to open a mobile account?
Internet Explorer ignores cookies on some domains (cannot read or set cookies)
Construction and maintenance of business website [3]
Welfare, let me introduce you to someone
Hot backup routing protocol (HSRP)
JDBC | Chapter 3: SQL precompile and anti injection crud operation
Record the problems encountered by nodejs asynchronism