当前位置:网站首页>Properties of binary tree~
Properties of binary tree~
2022-07-26 05:45:00 【[email protected]】
- It's not the second of an empty binary tree i layer , At most 2 i-1 Nodes ( i ≥1 )
deduction : There is a node in the first layer of a full binary tree , The root node , The second layer has two nodes , The third layer has four nodes , There are eight nodes on the fourth floor …
And so on , The first i layer , At most 2 i-1 Nodes
- At a height of h There are at most 2 h -1 Nodes ( h ≥1 )
deduction : Summation formula of equal ratio sequence : First item x(1 - Gongbi n )/(1 - Gongbi )
And in the non empty binary tree , Gongbi = 2, First item = 1, and n Is the height of the binary tree ( Or depth )
so: Total number of nodes = 1 x(1 - 2 h )/(1 - 2), After simplification :2 h -1
- For any non empty binary tree , If the number of leaf nodes is n0 , Degree is 2 The number of nodes of is n2 , Then there are :n0 = n2 + 1
deduction : Suppose for a non empty binary tree , The number of leaf nodes is n0, Degree is 1 The number of nodes of is n1 , Degree is 2 The number of nodes of is n2, be
Sum up points = n0 + n1 + n2 , The total number of edges = n1 + 2n2
Each node corresponds to an edge , Except for the root node
so: Sum up points -1 = The total number of edges —> n0 + n1 + n2 -1 = n1 + 2n2 —> n0 = n2 + 1
版权声明
本文为[[email protected]]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/207/202207260542336329.html
边栏推荐
- 87. Disturb string
- 高效,可靠,安全的串口通讯开源方案
- Yolov3 preparatory work
- C language explanation series -- understanding of functions (3) formal parameters, arguments, nested calls and chain access
- Mongodb common commands
- 102. (cesium chapter) cesium road streamer
- Another open source artifact, worth collecting and learning!
- 调试利器!一款轻量级日志库 log.c
- Polymer physics test question bank
- Qt编写物联网管理平台47-通用数据库设置
猜你喜欢
随机推荐
Debugging sharp weapon! A lightweight log library log.c
It's enough for newcomers to learn how to do functional tests
Redis 官方可视化工具,高颜值,功能真心强大!
Ros2 preliminary: basic communication with topic
Application and value of IVR in VoIP telephone system
这种项目,最好别接!
[STM32 series summary] blogger's way to quickly advance STM32 in actual combat (continuous update)
vagrant下载速度慢的解决方法
高效,可靠,安全的串口通讯开源方案
FTP experiment and overview
金仓数据库 KingbaseES SQL 语言参考手册 (8. 函数(十一))
Should we test the Dao layer?
Six sixths -- it's a little late and a little shallow
The idea YML file code does not prompt the solution
Hack the box - Web requests module detailed Chinese tutorial
Redis主从复制
虚拟偶像代言产品出问题谁负责? 且听律师分析
《MongoDB入门教程》第08篇 比较运算符
开发项目事半功倍,一款开源的stm32驱动库大集合
Lemon class automatic learning after all








