当前位置:网站首页>平衡二叉樹【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、删除
边栏推荐
- The for loop realizes 1-100 addition and eliminates the 4-digit tail number
- Design and implementation of spark offline development framework
- B_ QuRT_ User_ Guide(39)
- Unity3d learning notes 5 - create sub mesh
- B_QuRT_User_Guide(39)
- Oracle database backup and recovery
- USB (XVII) 2022-04-15
- Sequence of entity layer, Dao layer, service layer and controller layer
- Happy gathering time
- System design overview
猜你喜欢
Lm12 rolling heikin Ashi double K-line filter
Unity3d Learning Notes 6 - GPU instantiation (1)
[stm32+esp8266 connect Tencent cloud IOT development platform 2] stm32+esp8266-01s connect Tencent cloud
家用电器行业渠道商协同系统解决方案:助力家电企业快速实现渠道互联网化
Navicat connects Oracle
Solution of intelligent supply chain collaboration platform in electronic equipment industry: solve inefficiency and enable digital upgrading of industry
MongoDB快速入门
SAP memory parameter tuning process
Anxin vb01 offline voice module access intelligent curtain guidance
PCB wiring rules of PCI Express interface
随机推荐
B_QuRT_User_Guide(37)
Coreseek: the second step is index building and testing
HDU 4747 mex "recommended collection"
How can we make money by making video clips from our media?
C number of words, plus ¥, longest word, average value
Oracle statistics by time
IDEA 2021.3. X cracking
欢聚时代一面
Svn relocation
C method question 1
PHP uses Alibaba cloud storage
Matlab SEIR infectious disease model prediction
Slam interview summary
SLAM面试总结
Dependency injection 2 advantage lifecycle
The file format and extension of XLS do not match
Display the server hard disk image to the browser through Servlet
How to change the formula picture in the paper directly into the formula in word
B_QuRT_User_Guide(38)
高效的S2B2C电商系统,是这样帮助电子材料企业提升应变能力的