build
This commit is contained in:
parent
b3686c5c2e
commit
fc4406b5bd
@ -2,10 +2,10 @@
|
||||
comments: true
|
||||
---
|
||||
|
||||
# 2. 复杂度分析
|
||||
# 2. 复杂度
|
||||
|
||||
<div class="center-table" markdown>
|
||||
|
||||
{ width="70%" }
|
||||
{ width="70%" }
|
||||
|
||||
</div>
|
||||
|
@ -2,7 +2,7 @@
|
||||
comments: true
|
||||
---
|
||||
|
||||
# 3. 数据结构简介
|
||||
# 3. 数据结构
|
||||
|
||||
<div class="center-table" markdown>
|
||||
|
||||
|
@ -1450,7 +1450,7 @@ AVL 树的特点在于「旋转 Rotation」操作,它能够在不影响二叉
|
||||
```python title="avl_tree.py"
|
||||
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:
|
||||
"""递归插入节点(辅助方法)"""
|
||||
@ -1800,7 +1800,7 @@ AVL 树的特点在于「旋转 Rotation」操作,它能够在不影响二叉
|
||||
```python title="avl_tree.py"
|
||||
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:
|
||||
"""递归删除节点(辅助方法)"""
|
||||
|
@ -804,7 +804,7 @@ comments: true
|
||||
pre.right = child
|
||||
else:
|
||||
# 若删除节点为根节点,则重新指定根节点
|
||||
self.__root = child
|
||||
self.root = child
|
||||
# 子节点数量 = 2
|
||||
else:
|
||||
# 获取中序遍历中 cur 的下一个节点
|
||||
|
Loading…
Reference in New Issue
Block a user