refactor: Replace 结点 with 节点 (#452)

* Replace 结点 with 节点
Update the footnotes in the figures

* Update mindmap

* Reduce the size of the mindmap.png
This commit is contained in:
Yudong Jin
2023-04-09 04:32:17 +08:00
committed by GitHub
parent 3f4e32b2b0
commit 1c8b7ef559
395 changed files with 2056 additions and 2056 deletions

View File

@@ -12,7 +12,7 @@ def pre_order(root: TreeNode | None) -> None:
""" 前序遍历 """
if root is None:
return
# 访问优先级:根点 -> 左子树 -> 右子树
# 访问优先级:根点 -> 左子树 -> 右子树
res.append(root.val)
pre_order(root=root.left)
pre_order(root=root.right)
@@ -21,7 +21,7 @@ def in_order(root: TreeNode | None) -> None:
""" 中序遍历 """
if root is None:
return
# 访问优先级:左子树 -> 根点 -> 右子树
# 访问优先级:左子树 -> 根点 -> 右子树
in_order(root=root.left)
res.append(root.val)
in_order(root=root.right)
@@ -30,7 +30,7 @@ def post_order(root: TreeNode | None) -> None:
""" 后序遍历 """
if root is None:
return
# 访问优先级:左子树 -> 右子树 -> 根
# 访问优先级:左子树 -> 右子树 -> 根
post_order(root=root.left)
post_order(root=root.right)
res.append(root.val)
@@ -47,17 +47,17 @@ if __name__ == "__main__":
# 前序遍历
res = []
pre_order(root)
print("\n前序遍历的点打印序列 = ", res)
print("\n前序遍历的点打印序列 = ", res)
assert res == [1, 2, 4, 5, 3, 6, 7]
# 中序遍历
res.clear()
in_order(root)
print("\n中序遍历的点打印序列 = ", res)
print("\n中序遍历的点打印序列 = ", res)
assert res == [4, 2, 5, 1, 6, 3, 7]
# 后序遍历
res.clear()
post_order(root)
print("\n后序遍历的点打印序列 = ", res)
print("\n后序遍历的点打印序列 = ", res)
assert res == [4, 5, 2, 6, 7, 3, 1]