pull/944/head
krahets 1 year ago
parent b3686c5c2e
commit fc4406b5bd

@ -2,10 +2,10 @@
comments: true comments: true
--- ---
# 2.   复杂度分析 # 2.   复杂度
<div class="center-table" markdown> <div class="center-table" markdown>
![复杂度分析](../assets/covers/chapter_complexity_analysis.jpg){ width="70%" } ![复杂度](../assets/covers/chapter_complexity_analysis.jpg){ width="70%" }
</div> </div>

@ -2,7 +2,7 @@
comments: true comments: true
--- ---
# 3. &nbsp; 数据结构简介 # 3. &nbsp; 数据结构
<div class="center-table" markdown> <div class="center-table" markdown>

@ -1450,7 +1450,7 @@ AVL 树的特点在于「旋转 Rotation」操作它能够在不影响二叉
```python title="avl_tree.py" ```python title="avl_tree.py"
def insert(self, val) -> None: def insert(self, val) -> None:
"""插入节点""" """插入节点"""
self.__root = self.__insert_helper(self.__root, val) self.root = self.__insert_helper(self.root, val)
def __insert_helper(self, node: TreeNode | None, val: int) -> TreeNode: def __insert_helper(self, node: TreeNode | None, val: int) -> TreeNode:
"""递归插入节点(辅助方法)""" """递归插入节点(辅助方法)"""
@ -1800,7 +1800,7 @@ AVL 树的特点在于「旋转 Rotation」操作它能够在不影响二叉
```python title="avl_tree.py" ```python title="avl_tree.py"
def remove(self, val: int) -> None: def remove(self, val: int) -> None:
"""删除节点""" """删除节点"""
self.__root = self.__remove_helper(self.__root, val) self.root = self.__remove_helper(self.root, val)
def __remove_helper(self, node: TreeNode | None, val: int) -> TreeNode | None: def __remove_helper(self, node: TreeNode | None, val: int) -> TreeNode | None:
"""递归删除节点(辅助方法)""" """递归删除节点(辅助方法)"""

@ -804,7 +804,7 @@ comments: true
pre.right = child pre.right = child
else: else:
# 若删除节点为根节点,则重新指定根节点 # 若删除节点为根节点,则重新指定根节点
self.__root = child self.root = child
# 子节点数量 = 2 # 子节点数量 = 2
else: else:
# 获取中序遍历中 cur 的下一个节点 # 获取中序遍历中 cur 的下一个节点

Loading…
Cancel
Save