当前位置:网站首页>平衡二叉树【AVL树】——插入、删除
平衡二叉树【AVL树】——插入、删除
2022-07-07 21:52:00 【yyy_zxc】
1、平均查找长度(树高):
2、结点的平衡因子=左子树高-右子树高
平衡二叉树结点的平衡因子只可能是0,1或-1
2、插入
2.1 每次调整的对象都是“最小不平衡子树”
2.2 调整最小不平衡子树A
①LL【A的左孩子右上旋】:在A的左孩子的左子树中插入导致不平衡
②RR【A的右孩子左上旋】:在A的右孩子的右子树中插入导致不平衡
③LR【A的左孩子的右孩子先左上旋再右上旋】:
在A的左孩子的右子树中插入导致不平衡
④RL【A的右孩子的左孩子先右上旋再左上旋】:
在A的右孩子的左子树中插入导致不平衡
【注】每次旋转都会导致这个孩子变成爹,爹变成孩子
【注】只有左孩子才能右上旋
只有右孩子才能左上旋
3、删除
边栏推荐
- Lm12 rolling heikin Ashi double K-line filter
- Explain
- Cloud native data warehouse analyticdb MySQL user manual
- 2022 Season 6 perfect children's model Shaanxi finals came to a successful conclusion
- Design and implementation of spark offline development framework
- B_ QuRT_ User_ Guide(36)
- USB (XVI) 2022-04-28
- Anxinco esp32-a1s development board is adapted to Baidu dueros routine to realize online voice function
- IDEA 2021.3. X cracking
- VS扩展工具笔记
猜你喜欢
给出一个数组,如 [7864, 284, 347, 7732, 8498],现在需要将数组中的数字拼接起来,返回「最大的可能拼出的数字」
Explain
高效的S2B2C电商系统,是这样帮助电子材料企业提升应变能力的
Matlab SEIR infectious disease model prediction
Home appliance industry channel business collaboration system solution: help home appliance enterprises quickly realize the Internet of channels
Anxin can internally test offline voice module vb-01 to communicate with esp-c3-12f
[stm32+esp8266 connect Tencent cloud IOT development platform 2] stm32+esp8266-01s connect Tencent cloud
Cloud native is devouring everything. How should developers deal with it?
B_QuRT_User_Guide(36)
Digital procurement management system for fresh food industry: help fresh food enterprises solve procurement problems and implement online procurement throughout the process
随机推荐
System design overview
B_ QuRT_ User_ Guide(37)
深入理解Mysql锁与事务隔离级别
Anxin can internally test offline voice module vb-01 to communicate with esp-c3-12f
re1攻防世界逆向
[untitled]
Live server usage
2021icpc Shanghai h.life is a game Kruskal reconstruction tree
Experience sharing of system architecture designers in preparing for the exam: the direction of paper writing
Entity层、DAO层、Service层、Controller层 先后顺序
伸展树(一) - 图文解析与C语言实现
Explain
Solve the problem of duplicate request resource paths /o2o/shopadmin/o2o/shopadmin/getproductbyid
Markdown
HDU 4747 Mex「建议收藏」
移动端异构运算技术 - GPU OpenCL 编程(基础篇)
Flash encryption process and implementation of esp32
B_QuRT_User_Guide(36)
Given an array, such as [7864, 284, 347, 7732, 8498], now you need to splice the numbers in the array to return the "largest possible number."
648. Word replacement