当前位置:网站首页>平衡二叉樹【AVL樹】——插入、删除
平衡二叉樹【AVL樹】——插入、删除
2022-07-07 23:37: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、删除

边栏推荐
- Possible SQL for Oracle table lookup information
- USB (XIV) 2022-04-12
- POJ2392 SpaceElevator [DP]
- Lm12 rolling heikin Ashi double K-line filter
- 【7.4】25. Turn over the linked list in groups of K
- Vulnerability recurrence ----- 49. Apache airflow authentication bypass (cve-2020-17526)
- 伸展树(一) - 图文解析与C语言实现
- Right click the idea file to create new. There is no solution to create new servlet
- 给出一个数组,如 [7864, 284, 347, 7732, 8498],现在需要将数组中的数字拼接起来,返回「最大的可能拼出的数字」
- Oracle database backup and recovery
猜你喜欢

List. How to achieve ascending and descending sort() 2020.8.6

KeePass realizes automatic input of web pages

Vulnerability recurrence ----- 49. Apache airflow authentication bypass (cve-2020-17526)

SAP HR reward and punishment information export

Ora-02437 failed to verify the primary key violation

Interface

C simple question one

伸展树(一) - 图文解析与C语言实现

B_ QuRT_ User_ Guide(36)

B_ QuRT_ User_ Guide(37)
随机推荐
【7.5】15. 三数之和
Live-Server使用
Deep understanding of MySQL lock and transaction isolation level
[stm32+esp8266 connects to Tencent cloud IOT development platform 3] stm32+esp8266-01s dynamically registers devices on Tencent cloud (at instruction mode) -- with source code
电子设备行业智能供应链协同平台解决方案:解决低效, 赋能产业数字化升级
How to change the formula picture in the paper directly into the formula in word
Entity层、DAO层、Service层、Controller层 先后顺序
城联优品作为新力量初注入,相关上市公司股价应声上涨150%
Possible SQL for Oracle table lookup information
SQL database execution problems
Extended tree (I) - graphic analysis and C language implementation
Class C design questions
Solution of intelligent supply chain collaboration platform in electronic equipment industry: solve inefficiency and enable digital upgrading of industry
POJ2392 SpaceElevator [DP]
C simple question 2
2022第六季完美童模陕西总决赛圆满落幕
HDU 4747 Mex「建议收藏」
C cat and dog
USB (XVII) 2022-04-15
S2b2b mall solution of intelligent supply chain in packaging industry: opening up a new ecosystem of e-commerce consumption