当前位置:网站首页>平衡二叉樹【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、删除
边栏推荐
- 8.31 Tencent interview
- New potential energy of industrial integration, Xiamen station of city chain technology digital summit successfully held
- Oracle statistics by time
- B_QuRT_User_Guide(36)
- SQL database execution problems
- Summary of common methods of object class (September 14, 2020)
- Design and implementation of spark offline development framework
- Dependency injection 2 advantage lifecycle
- 移动端异构运算技术 - GPU OpenCL 编程(基础篇)
- 2022注册测绘师备考开始 还在不知所措?手把手教你怎么考?
猜你喜欢
家用电器行业渠道商协同系统解决方案:助力家电企业快速实现渠道互联网化
SAP HR labor contract information 0016
进度播报|广州地铁七号线全线29台盾构机全部完成始发
0-1 knapsack problem
2021icpc Shanghai h.life is a game Kruskal reconstruction tree
[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
ESP at installation esp8266 and esp32 versions
PCB wiring rules of PCI Express interface
生鲜行业数字化采购管理系统:助力生鲜企业解决采购难题,全程线上化采购执行
MATLAB signal processing [Q & A essays · 2]
随机推荐
ASP. Net core middleware request processing pipeline
Possible SQL for Oracle table lookup information
SAP HR social work experience 0023
Progress broadcast | all 29 shield machines of Guangzhou Metro Line 7 have been launched
2021icpc Shanghai h.life is a game Kruskal reconstruction tree
SAP HR 社会工作经历 0023
B_ QuRT_ User_ Guide(37)
Unity3d learning notes 4 - create mesh advanced interface
Markdown
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."
Display the server hard disk image to the browser through Servlet
Caip2021 preliminary VP
C number of words, plus ¥, longest word, average value
MongoDB快速入门
Dependency injection 2 advantage lifecycle
Understand TCP's three handshakes and four waves with love
Boost regex library source code compilation
8.31 Tencent interview
Illegal behavior analysis 1
As a new force, chenglian premium products was initially injected, and the shares of relevant listed companies rose 150% in response