Update 5.5二叉排序树.md

This commit is contained in:
岩岩
2022-03-29 11:35:04 +08:00
committed by GitHub
parent ddc518606e
commit 34d51cd402

View File

@@ -161,21 +161,21 @@ void Creat_BST(BSTree &T, int str[],int n){
①若被删除结点z是`叶子结点`,则`直接删除`,不会破坏二叉排序树的性质。
![1636465960055](F:\408数据结构\图片\1636465960055.png)
![1636465960055](https://github.com/oxyanyano/2022-WangDao-CS-DS-Notes/blob/main/images/1636465960055.png)
②若结点z只有一颗左子树或右子树则让z的子树分为z父结点的子树代替z的位置
![1636465960051](F:\408数据结构\图片\1636465960051.png)
![1636465960051](https://github.com/oxyanyano/2022-WangDao-CS-DS-Notes/blob/main/images/1636465960051.png)
③若结点z有左、右两棵子树则令z的直接后继(或直接前驱)替代z然后从二叉排序树中删去这个直接后继(或直接前驱),这样就转换成了第一或第二种情况。
直接后继代替
![1636465960047](F:\408数据结构\图片\1636465960047.png)
![1636465960047](https://github.com/oxyanyano/2022-WangDao-CS-DS-Notes/blob/main/images/1636465960047.png)
直接前驱代替
![1636466293090](F:\408数据结构\图片\1636466293090.png)
![1636466293090](https://github.com/oxyanyano/2022-WangDao-CS-DS-Notes/blob/main/images/1636466293090.png)
### 七、查找效率的分析
@@ -193,8 +193,8 @@ void Creat_BST(BSTree &T, int str[],int n){
查找`成功`的平均查找长度:
![1637587381063](F:\408数据结构\图片\1637587381063.png)
![1637587381063](https://github.com/oxyanyano/2022-WangDao-CS-DS-Notes/blob/main/images/1637587381063.png)
查找`失败`的平均查找长度:
![1637587381058](F:\408数据结构\图片\1637587381058.png)
![1637587381058](https://github.com/oxyanyano/2022-WangDao-CS-DS-Notes/blob/main/images/1637587381058.png)