当前位置:网站首页>二叉树五个重要性质(附图理解)
二叉树五个重要性质(附图理解)
2022-04-22 05:29:00 【所谓独醉】
二叉树五个重要性质
先附一个图

性质1:在二叉树的第i层上最多有2^(i-1)个结点(i≥1)
性质2:深度为k的二叉树至多有2^k-1个结点(k≥1)
注意是2的k次方后再减去1,而不是2^(k-1)。
上图为满二叉树,节点数为2^4 - 1 = 15
性质3:对任何一棵二叉树,如果其终端结点数为n0,度为2的结点数为n2,则n0=n2+1
如上图所示,8–15为终端节点数,n0 = 8, 1-- 7为度为2的节点,n2 = 7
性质4:具有n个结点的完全二叉树的深度为|log2(n)| + 1
(表示不大于log2(n) + 1对数的最大值)
|log2(15)| = 3 , 3 + 1 = 4
性质5:如果对一棵有n个结点的完全二叉树(其深度为|log2(n)| + 1)的结点按层序编号(从第一层到第|log2(n)| + 1层,每层从左到右),对任一结点i(1<=i<=n),有
1.如果i = 1,则结点i是二叉树的根,无双亲;如果i>1,则其双亲是结点|i / 2|(取整)。
2.如果2i > n,则结点i无左孩子(结点i为叶子结点);否则其左孩子是结点2i。
3.如果2i+1>n,则结点i无右孩子;否则其右孩子是结点2i+1
版权声明
本文为[所谓独醉]所创,转载请带上原文链接,感谢
https://blog.csdn.net/m0_51126511/article/details/124335239
边栏推荐
- Idea 2021.1 Useful settings
- Sword finger offer | merge two sorted linked lists
- Strategy mode (2.28-3.6)
- 13.9.1-PointersOnC-20220421
- Parsing of thread safe classes: (2.8-3.6)
- AssetBundle packaging based on unitygameframework framework
- Why choose B + tree as the underlying engine of MySQL: (3.28-4.3)
- C language version: establishment and basic operation of circular queue
- IT配电及防火限流式保护器应用及选型
- [WPF] data template selector
猜你喜欢

Application and selection of it power distribution and fire current limiting protector

Unable to resolve dependency for ': app@debug /compileClasspath': Could not download mapsforge-map. jar
我的创作纪念日

Sourcetree version backtracking and single change version backtracking

After unity is connected to the ilruntime, the package method under packages is applied to the hot engineering application, such as unity RenderPipelines. Core. Runtime package
![[WPF] customize combobox](/img/99/21298293139f6acb9d0144236b825e.png)
[WPF] customize combobox
![[WPF] converter](/img/e7/c4dff7af0a9db846afd20fafb8313e.png)
[WPF] converter
![[WPF] cascaded combobox](/img/19/a83dc60abcfcc6ddcf06dc80860ab6.png)
[WPF] cascaded combobox

Network attack and Defense Security Learning Platform - upload key 3

Fundamentals of graphics - depth buffer
随机推荐
Analysis of database log level: (2022.2.21-2022.2.27)
Unity creates dynamic classes through reflection
[WPF] data template selector
Using easyexcel to export excel forms
Unreal engine sequence effect and audio binding trigger
GBase 8s V8.8 SQL 指南:教程-6.1
2022.4.21-----leetcode. eight hundred and twenty-four
Status mode (4.4-4.10)
C language version: establishment and basic operation of circular queue
IT配电及防火限流式保护器应用及选型
C language practice (2) -- polynomial addition with linked list
Multithreaded rendering mechanism of Unreal Engine
AWD platform construction – cardinal
Keil-C51 与 Keil -ARM 共存的方法
Event system for ugui source code analysis in unity (9) - input module (2)
C language version: the pre order, middle order and post order non recursive traversal of binary tree
Codeforces Round #783 (Div. 2) ABCD
Codeforces round 783 (Div. 2) d - optimal partition (DP / weight segment tree 2100)
Unity about the real machine failure of ispointerovergameobject interface
[WPF] use ellipse or rectangle to make circular progress bar