当前位置:网站首页>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
边栏推荐
- Research Report on plastic antioxidant industry - market status analysis and development prospect forecast
- Internet Explorer ignores cookies on some domains (cannot read or set cookies)
- Research Report on crude oil tanker industry - market status analysis and development prospect forecast
- 26 FPS video super-resolution model DAP! Output 720p Video Online
- [dynamic planning] p1220: interval DP: turn off the street lights
- Research Report on the overall scale, major manufacturers, major regions, products and applications of building automation power meters in the global market in 2022
- Redis -- three special data types
- Micro SD Card Industry Research Report - market status analysis and development prospect forecast
- Talk about macromolecule coding theory and Lao Wang's fallacy from the perspective of evolution theory
- Hot backup routing protocol (HSRP)
猜你喜欢
[shutter] statefulwidget component (bottom navigation bar component | bottomnavigationbar component | bottomnavigationbaritem component | tab switching)
I drew a Gu ailing with characters!
7. Build native development environment
[dynamic planning] p1220: interval DP: turn off the street lights
Add two numbers of leetcode
Welfare, let me introduce you to someone
[hands on deep learning]02 softmax regression
Activation function - relu vs sigmoid
[shutter] statefulwidget component (image component | textfield component)
5 environment construction spark on yarn
随机推荐
Construction and maintenance of business websites [8]
Research Report on market supply and demand and strategy of Chinese garden equipment industry
想问问,现在开户有优惠吗?在线开户是安全么?
BitSet complement
Huawei Hongmeng watch achieves fireworks display effect on New Year's Eve
Report on investment development and strategic recommendations of China's vibration isolator market, 2022-2027
Construction and maintenance of business website [5]
Customized Huawei hg8546m restores Huawei's original interface
Codeworks global round 19 (CF 1637) a ~ e problem solution
MySQL learning notes (Advanced)
Who do you want to open a stock account? Is it safe to open a mobile account?
[shutter] the shutter plug-in is used in the shutter project (shutter plug-in management platform | search shutter plug-in | install shutter plug-in | use shutter plug-in)
Web3js method to obtain account information and balance
Number of DP schemes
Research Report on crude oil tanker industry - market status analysis and development prospect forecast
1005 spell it right (20 points) "PTA class a exercise"
Research Report on the overall scale, major manufacturers, major regions, products and applications of battery control units in the global market in 2022
Market trend report, technical dynamic innovation and market forecast of China's low gloss instrument
[error record] the command line creates an error pub get failed (server unavailable) -- attempting retry 1 in 1 second
kernel tty_ struct