From ada37fd1f87aa30f6aaf71b9045e8a6e99170b27 Mon Sep 17 00:00:00 2001 From: krahets Date: Sat, 14 Oct 2023 22:15:02 +0800 Subject: [PATCH] Fix Python code. --- codes/python/chapter_array_and_linkedlist/my_list.py | 10 +++------- docs/chapter_tree/avl_tree.md | 12 ++++++------ 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/codes/python/chapter_array_and_linkedlist/my_list.py b/codes/python/chapter_array_and_linkedlist/my_list.py index 9e84fedb3..c78ac43a0 100644 --- a/codes/python/chapter_array_and_linkedlist/my_list.py +++ b/codes/python/chapter_array_and_linkedlist/my_list.py @@ -1,5 +1,5 @@ """ -File: nums.py +File: my_list.py Created Time: 2022-11-25 Author: Krahets (krahets@163.com) """ @@ -93,9 +93,7 @@ if __name__ == "__main__": nums.add(2) nums.add(5) nums.add(4) - print( - f"列表 nums = {nums.to_array()} ,容量 = {nums.capacity()} ,长度 = {nums.size()}" - ) + print(f"列表 nums = {nums.to_array()} ,容量 = {nums.capacity()} ,长度 = {nums.size()}") # 中间插入元素 nums.insert(6, index=3) @@ -117,6 +115,4 @@ if __name__ == "__main__": for i in range(10): # 在 i = 5 时,列表长度将超出列表容量,此时触发扩容机制 nums.add(i) - print( - f"扩容后的列表 {nums.to_array()} ,容量 = {nums.capacity()} ,长度 = {nums.size()}" - ) + print(f"扩容后的列表 {nums.to_array()} ,容量 = {nums.capacity()} ,长度 = {nums.size()}") diff --git a/docs/chapter_tree/avl_tree.md b/docs/chapter_tree/avl_tree.md index a226a2e2b..ab5f5ba31 100644 --- a/docs/chapter_tree/avl_tree.md +++ b/docs/chapter_tree/avl_tree.md @@ -216,7 +216,7 @@ AVL 树既是二叉搜索树也是平衡二叉树,同时满足这两类二叉 ```python title="avl_tree.py" [class]{AVLTree}-[func]{height} - [class]{AVLTree}-[func]{__update_height} + [class]{AVLTree}-[func]{update_height} ``` === "C++" @@ -418,7 +418,7 @@ AVL 树的特点在于“旋转”操作,它能够在不影响二叉树的中 === "Python" ```python title="avl_tree.py" - [class]{AVLTree}-[func]{__right_rotate} + [class]{AVLTree}-[func]{right_rotate} ``` === "C++" @@ -502,7 +502,7 @@ AVL 树的特点在于“旋转”操作,它能够在不影响二叉树的中 === "Python" ```python title="avl_tree.py" - [class]{AVLTree}-[func]{__left_rotate} + [class]{AVLTree}-[func]{left_rotate} ``` === "C++" @@ -605,7 +605,7 @@ AVL 树的特点在于“旋转”操作,它能够在不影响二叉树的中 === "Python" ```python title="avl_tree.py" - [class]{AVLTree}-[func]{__rotate} + [class]{AVLTree}-[func]{rotate} ``` === "C++" @@ -685,7 +685,7 @@ AVL 树的节点插入操作与二叉搜索树在主体上类似。唯一的区 ```python title="avl_tree.py" [class]{AVLTree}-[func]{insert} - [class]{AVLTree}-[func]{__insert_helper} + [class]{AVLTree}-[func]{insert_helper} ``` === "C++" @@ -785,7 +785,7 @@ AVL 树的节点插入操作与二叉搜索树在主体上类似。唯一的区 ```python title="avl_tree.py" [class]{AVLTree}-[func]{remove} - [class]{AVLTree}-[func]{__remove_helper} + [class]{AVLTree}-[func]{remove_helper} ``` === "C++"