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

边栏推荐
- 谷歌浏览器怎么登录及开启同步功能
- How to login and enable synchronization function in Google browser
- C inheritance and interface design polymorphism
- Summary of common methods of object class (September 14, 2020)
- Coreseek: the second step is index building and testing
- Deep understanding of MySQL lock and transaction isolation level
- UE4_ Ue5 panoramic camera
- B_ QuRT_ User_ Guide(38)
- 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."
- B_QuRT_User_Guide(39)
猜你喜欢

How to change the formula picture in the paper directly into the formula in word

SAP HR family member information
![Given an array, such as [7864, 284, 347, 7732, 8498], now you need to splice the numbers in the array to return the](/img/21/2e99dd6173ab4925ec22290cd4a357.png)
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."

Senior programmers must know and master. This article explains in detail the principle of MySQL master-slave synchronization, and recommends collecting

SAP HR奖罚信息导出

Class C design questions

UE4_ Ue5 panoramic camera

As a new force, chenglian premium products was initially injected, and the shares of relevant listed companies rose 150% in response

Solution of intelligent supply chain collaboration platform in electronic equipment industry: solve inefficiency and enable digital upgrading of industry

Anxin can internally test offline voice module vb-01 to communicate with esp-c3-12f
随机推荐
0-1 knapsack problem
ASP. Net query implementation
Summary of common methods of object class (September 14, 2020)
JNI uses asan to check memory leaks
0-1背包问题
Have all the fresh students of 2022 found jobs? Is it OK to be we media?
KeePass realizes automatic input of web pages
List. How to achieve ascending and descending sort() 2020.8.6
[untitled]
The efficient s2b2c e-commerce system helps electronic material enterprises improve their adaptability in this way
Map operation execution process
Live server usage
Anxinco esp32-a1s development board is adapted to Baidu dueros routine to realize online voice function
2022 届的应届生都找到工作了吗?做自媒体可以吗?
Deep understanding of MySQL lock and transaction isolation level
Anxinco EC series modules are connected to the multi protocol access products of onenet Internet of things open platform
S2b2b mall solution of intelligent supply chain in packaging industry: opening up a new ecosystem of e-commerce consumption
Oracle database backup and recovery
建筑建材行业SRM供应商云协同管理平台解决方案,实现业务应用可扩展可配置
ASP. Net core middleware request processing pipeline