当前位置:网站首页>平衡二叉树【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、删除

边栏推荐
- 8.31 Tencent interview
- Dynamic agent explanation (July 16, 2020)
- Extended tree (I) - graphic analysis and C language implementation
- Anxin vb01 offline voice module access intelligent curtain guidance
- 2021icpc Shanghai h.life is a game Kruskal reconstruction tree
- The text editor of markdown class should add colors to fonts (including typora, CSDN, etc.)
- How can we make money by making video clips from our media?
- Deep understanding of MySQL lock and transaction isolation level
- VS扩展工具笔记
- Mobile heterogeneous computing technology - GPU OpenCL programming (basic)
猜你喜欢

Anxinco EC series modules are connected to the multi protocol access products of onenet Internet of things open platform

New potential energy of industrial integration, Xiamen station of city chain technology digital summit successfully held

Anxinco esp32-a1s development board is adapted to Baidu dueros routine to realize online voice function

USB (XV) 2022-04-14

Solve the problem of duplicate request resource paths /o2o/shopadmin/o2o/shopadmin/getproductbyid

Matlab SEIR infectious disease model prediction
![Ros2 topic (03): the difference between ros1 and ros2 [02]](/img/12/244ea30b5b141a0f47a54c08f4fe9f.png)
Ros2 topic (03): the difference between ros1 and ros2 [02]

Deep understanding of MySQL lock and transaction isolation level

2022 certified surveyors are still at a loss when preparing for the exam? Teach you how to take the exam hand in hand?

Explain
随机推荐
The efficient s2b2c e-commerce system helps electronic material enterprises improve their adaptability in this way
re1攻防世界逆向
USB (XV) 2022-04-14
The 19th Zhejiang Provincial College Programming Contest VP record + supplementary questions
Count the top 10 films at the box office and save them in another file
Entity层、DAO层、Service层、Controller层 先后顺序
2022 Season 6 perfect children's model Shaanxi finals came to a successful conclusion
B_QuRT_User_Guide(38)
【7.5】15. Sum of three numbers
Vulnerability recurrence ----- 49. Apache airflow authentication bypass (cve-2020-17526)
Matlab SEIR infectious disease model prediction
【7.4】25. Turn over the linked list in groups of K
进度播报|广州地铁七号线全线29台盾构机全部完成始发
LM12丨Rolling Heikin Ashi二重K线滤波器
给出一个数组,如 [7864, 284, 347, 7732, 8498],现在需要将数组中的数字拼接起来,返回「最大的可能拼出的数字」
Freelink open source call center design idea
KeePass realizes automatic input of web pages
Open source hardware small project: anxinco esp-c3f control ws2812
Map operation execution process
Anxin vb01 offline voice module access intelligent curtain guidance