当前位置:网站首页>Five important properties of binary tree
Five important properties of binary tree
2022-04-22 05:35:00 【The so-called drunk alone】
Five important properties of binary tree
Attach a diagram first

nature 1: On the second of the binary tree i There is a maximum of 2^(i-1) Nodes (i≥1)
nature 2: Depth is k At most, the binary tree of 2^k-1 Nodes (k≥1)
Note that 2 Of k Subtract... To the power of 1, instead of 2^(k-1).
The figure above shows a full binary tree , The number of nodes is 2^4 - 1 = 15
nature 3: Any binary tree , If the number of terminal nodes is zero n0, Degree is 2 The node number of is n2, be n0=n2+1
As shown in the figure above ,8–15 Is the number of terminal nodes ,n0 = 8, 1-- 7 For the degree of 2 The node of ,n2 = 7
nature 4: have n The depth of a complete binary tree of nodes is |log2(n)| + 1
( No greater than log2(n) + 1 The maximum value of logarithm )
|log2(15)| = 3 , 3 + 1 = 4
nature 5: If there is n Complete binary tree of nodes ( Its depth is |log2(n)| + 1) The nodes of are numbered by sequence ( From the first floor to the |log2(n)| + 1 layer , Left to right for each floor ), For any node i(1<=i<=n), Yes
1. If i = 1, Then node i It's the root of a binary tree , Unmarried parents ; If i>1, Then their parents are nodes |i / 2|( integer ).
2. If 2i > n, Then node i No left child ( node i For leaf nodes ); Otherwise, the left child is the node 2i.
3. If 2i+1>n, Then node i No right child ; Otherwise, the right child is the node 2i+1
版权声明
本文为[The so-called drunk alone]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220529476655.html
边栏推荐
- Aiming position of unity shooting game
- The unreal engine uses loadclass to load the blueprint class
- GBase 8s V8. 8 SQL Guide: Tutorial - 6.1.1 (1)
- General compilation methods of third-party libraries such as libcurl
- Implementation of unity simple event system
- NP, OSPF neighbor adjacency
- Time complexity and space complexity
- libcurl等第三方库通用编译方法
- MySQL数据库基础
- Codeforces Round #783 (Div. 2) D - Optimal Partition(dp/权值线段树 2100)
猜你喜欢

MySQL事务

Online Tetris with automatic hang-up source code

MySQL数据库基础

Fundamentals of graphics - flood

C language practice (2) -- polynomial addition with linked list

C language version: establishment and basic operation of chain team

Auto.js 画布设置防锯齿paint.setAntiAlias(true);

Sourcetree version backtracking and single change version backtracking

Fundamentals of graphics | real time shadow rendering

C language version: static establishment of binary tree
随机推荐
Spark 之 unsafeRow
Kaggle_ Detailed explanation of NBME NLP competition baseline (2)
Codeforces Round #783 (Div. 2) D - Optimal Partition(dp/权值线段树 2100)
Unity built-in terrain optimization
IT配电及防火限流式保护器应用及选型
Access denied for user 'root' @ '% MySQL problem (solved)
Auto.js 画布设置防锯齿paint.setAntiAlias(true);
String and byte [] turn to each other
MySQL索引
GBase 8s V8.8 SQL 指南:教程-5.3
GBase 8s V8. 8 SQL Guide: Tutorial - 5.3.1
GBase 8s V8. 8 SQL Guide: Tutorial - 6.1.1 (1)
Sword finger offer | merge two sorted linked lists
時間複雜度和空間複雜度
[candelastudio edit CDD] - 2.3 - realize the jump between multiple securitylevels of $27 service (UDS diagnosis)
Fundamentals of Unreal Engine Programming (II)
时间复杂度和空间复杂度
ENUM et expressions lambda
C language version: traversal mode and reverse order of binary tree
Basic configuration of NP and OSPF