当前位置:网站首页>平衡二叉树【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、删除
边栏推荐
- Three questions TDM
- Unity3d learning notes 5 - create sub mesh
- How to change the formula picture in the paper directly into the formula in word
- Matlab SEIR infectious disease model prediction
- Markdown
- 城联优品作为新力量初注入,相关上市公司股价应声上涨150%
- Solve the problem of duplicate request resource paths /o2o/shopadmin/o2o/shopadmin/getproductbyid
- USB (XV) 2022-04-14
- FPGA basics catalog
- 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."
猜你喜欢
2022 Season 6 perfect children's model Shaanxi finals came to a successful conclusion
List. How to achieve ascending and descending sort() 2020.8.6
SAP 内存参数调优过程
Matlab SEIR infectious disease model prediction
产业共融新势能,城链科技数字峰会厦门站成功举办
PCB wiring rules of PCI Express interface
MATLAB signal processing [Q & A essays · 2]
LeeCode -- 6. Z 字形变换
LeeCode -- 6. Zigzag transformation
B_QuRT_User_Guide(36)
随机推荐
Summary of common methods of object class (September 14, 2020)
USB (XIV) 2022-04-12
包装行业智能供应链S2B2B商城解决方案:开辟电商消费新生态
Cloud native is devouring everything. How should developers deal with it?
v-for遍历对象
KeePass realizes automatic input of web pages
Freelink open source call center design idea
[stm32+esp8266 connect Tencent cloud IOT development platform 2] stm32+esp8266-01s connect Tencent cloud
生鲜行业数字化采购管理系统:助力生鲜企业解决采购难题,全程线上化采购执行
First week of July
Digital procurement management system for fresh food industry: help fresh food enterprises solve procurement problems and implement online procurement throughout the process
Turbo introder common scripts
C simple question one
Summary of SQL single table query 2020.7.27
云原生正在吞噬一切,开发者该如何应对?
[untitled]
Mobile heterogeneous computing technology - GPU OpenCL programming (basic)
0-1 knapsack problem
IDEA 2021.3. X cracking
Solve the problem of duplicate request resource paths /o2o/shopadmin/o2o/shopadmin/getproductbyid