| 方法 | 描述 | 时间复杂度 |
@@ -603,7 +601,7 @@ comments: true
考虑从入堆结点开始,**从底至顶执行堆化**。具体地,比较插入结点与其父结点的值,若插入结点更大则将它们交换;并循环以上操作,从底至顶地修复堆中的各个结点;直至越过根结点时结束,或当遇到无需交换的结点时提前结束。
=== "<1>"
- 
+ 
=== "<2>"

@@ -885,7 +883,7 @@ comments: true
顾名思义,**从顶至底堆化的操作方向与从底至顶堆化相反**,我们比较根结点的值与其两个子结点的值,将最大的子结点与根结点执行交换,并循环以上操作,直到越过叶结点时结束,或当遇到无需交换的结点时提前结束。
=== "<1>"
- 
+ 
=== "<2>"

diff --git a/chapter_introduction/algorithms_are_everywhere.md b/chapter_introduction/algorithms_are_everywhere.md
index c89a9f54c..efee9efe6 100644
--- a/chapter_introduction/algorithms_are_everywhere.md
+++ b/chapter_introduction/algorithms_are_everywhere.md
@@ -19,7 +19,7 @@ comments: true
3. 循环执行步骤 1-2 ,直到找到拼音首字母为 $r$ 的页码时终止。
=== "<1>"
- 
+ 
=== "<2>"

diff --git a/chapter_searching/binary_search.md b/chapter_searching/binary_search.md
index c4988ad7a..d5babb288 100755
--- a/chapter_searching/binary_search.md
+++ b/chapter_searching/binary_search.md
@@ -29,7 +29,7 @@ $$
首先,我们先采用“双闭区间”的表示,在数组 `nums` 中查找目标元素 `target` 的对应索引。
=== "<1>"
- 
+ 
=== "<2>"

diff --git a/chapter_searching/summary.md b/chapter_searching/summary.md
index debefa363..1d94a87d5 100644
--- a/chapter_searching/summary.md
+++ b/chapter_searching/summary.md
@@ -8,8 +8,6 @@ comments: true
- 二分查找利用数据的有序性,通过循环不断缩小一半搜索区间来实现查找,其要求输入数据是有序的,并且仅适用于数组或基于数组实现的数据结构。
- 哈希查找借助哈希表来实现常数阶时间复杂度的查找操作,体现以空间换时间的算法思想。
-
Table. 三种查找方法对比
| | 线性查找 | 二分查找 | 哈希查找 |
diff --git a/chapter_sorting/bubble_sort.md b/chapter_sorting/bubble_sort.md
index 60864e5a7..afd7c84b6 100755
--- a/chapter_sorting/bubble_sort.md
+++ b/chapter_sorting/bubble_sort.md
@@ -15,7 +15,7 @@ comments: true
完成此次冒泡操作后,**数组最大元素已在正确位置,接下来只需排序剩余 $n - 1$ 个元素**。
=== "<1>"
- 
+ 
=== "<2>"

@@ -35,8 +35,6 @@ comments: true
=== "<7>"

-
Fig. 冒泡操作
-
## 11.2.1. 算法流程
1. 设数组长度为 $n$ ,完成第一轮「冒泡」后,数组最大元素已在正确位置,接下来只需排序剩余 $n - 1$ 个元素。
diff --git a/chapter_sorting/merge_sort.md b/chapter_sorting/merge_sort.md
index 26f64988a..eaa88cb32 100755
--- a/chapter_sorting/merge_sort.md
+++ b/chapter_sorting/merge_sort.md
@@ -23,7 +23,7 @@ comments: true
需要注意,由于从长度为 1 的子数组开始合并,所以 **每个子数组都是有序的**。因此,合并任务本质是要 **将两个有序子数组合并为一个有序数组**。
=== "<1>"
- 
+ 
=== "<2>"

diff --git a/chapter_sorting/quick_sort.md b/chapter_sorting/quick_sort.md
index 5a61989cf..1fd0d5d18 100755
--- a/chapter_sorting/quick_sort.md
+++ b/chapter_sorting/quick_sort.md
@@ -15,7 +15,7 @@ comments: true
「哨兵划分」执行完毕后,原数组被划分成两个部分,即 **左子数组** 和 **右子数组**,且满足 **左子数组任意元素 < 基准数 < 右子数组任意元素**。因此,接下来我们只需要排序两个子数组即可。
=== "<1>"
- 
+ 
=== "<2>"

diff --git a/chapter_stack_and_queue/deque.md b/chapter_stack_and_queue/deque.md
index 9cb235daa..ed0c61251 100644
--- a/chapter_stack_and_queue/deque.md
+++ b/chapter_stack_and_queue/deque.md
@@ -12,8 +12,6 @@ comments: true
双向队列的常用操作见下表,方法名需根据特定语言来确定。
-
Table. 双向队列的常用操作
-
| 方法名 | 描述 | 时间复杂度 |
@@ -304,7 +302,7 @@ comments: true
我们将双向链表的头结点和尾结点分别看作双向队列的队首和队尾,并且实现在两端都能添加与删除结点。
=== "LinkedListDeque"
- 
+ 
=== "pushLast()"

@@ -880,7 +878,7 @@ comments: true
与基于数组实现队列类似,我们也可以使用环形数组来实现双向队列。在实现队列的基础上,增加实现“队首入队”和“队尾出队”方法即可。
=== "ArrayDeque"
- 
+ 
=== "pushLast()"

diff --git a/chapter_stack_and_queue/queue.md b/chapter_stack_and_queue/queue.md
index 38bbc94fe..52fe933e3 100755
--- a/chapter_stack_and_queue/queue.md
+++ b/chapter_stack_and_queue/queue.md
@@ -14,8 +14,6 @@ comments: true
队列的常用操作见下表,方法名需根据特定语言来确定。
-
Table. 队列的常用操作
-
| 方法名 | 描述 | 时间复杂度 |
@@ -269,7 +267,7 @@ comments: true
我们将链表的「头结点」和「尾结点」分别看作是队首和队尾,并规定队尾只可添加结点,队首只可删除结点。
=== "LinkedListQueue"
- 
+ 
=== "push()"

@@ -940,7 +938,7 @@ comments: true
观察发现,入队与出队操作都仅需单次操作即可完成,时间复杂度皆为 $O(1)$ 。
=== "ArrayQueue"
- 
+ 
=== "push()"

diff --git a/chapter_stack_and_queue/stack.md b/chapter_stack_and_queue/stack.md
index 80a86c6dd..cd07e7bc7 100755
--- a/chapter_stack_and_queue/stack.md
+++ b/chapter_stack_and_queue/stack.md
@@ -16,8 +16,6 @@ comments: true
栈的常用操作见下表(方法命名以 Java 为例)。
-
Table. 栈的常用操作
-
| 方法 | 描述 | 时间复杂度 |
@@ -272,7 +270,7 @@ comments: true
对于入栈操作,将元素插入到链表头部即可,这种结点添加方式被称为“头插法”。而对于出栈操作,则将头结点从链表中删除即可。
=== "LinkedListStack"
- 
+ 
=== "push()"

@@ -849,7 +847,7 @@ comments: true
使用「数组」实现栈时,考虑将数组的尾部当作栈顶。这样设计下,「入栈」与「出栈」操作就对应在数组尾部「添加元素」与「删除元素」,时间复杂度都为 $O(1)$ 。
=== "ArrayStack"
- 
+ 
=== "push()"

diff --git a/chapter_tree/avl_tree.md b/chapter_tree/avl_tree.md
index 584d7c384..cee11d176 100644
--- a/chapter_tree/avl_tree.md
+++ b/chapter_tree/avl_tree.md
@@ -455,7 +455,7 @@ AVL 树的独特之处在于「旋转 Rotation」的操作,其可 **在不影
如下图所示(结点下方为「平衡因子」),从底至顶看,二叉树中首个失衡结点是 **结点 3**。我们聚焦在以该失衡结点为根结点的子树上,将该结点记为 `node` ,将其左子结点记为 `child` ,执行「右旋」操作。完成右旋后,该子树已经恢复平衡,并且仍然为二叉搜索树。
=== "<1>"
- 
+ 
=== "<2>"

diff --git a/chapter_tree/binary_search_tree.md b/chapter_tree/binary_search_tree.md
index e67a048e3..24f24df3d 100755
--- a/chapter_tree/binary_search_tree.md
+++ b/chapter_tree/binary_search_tree.md
@@ -22,7 +22,7 @@ comments: true
- 若 `cur.val = num` ,说明找到目标结点,跳出循环并返回该结点即可;
=== "<1>"
- 
+ 
=== "<2>"

@@ -562,7 +562,7 @@ comments: true
3. 使用 `nex` 替换待删除结点;
=== "<1>"
- 
+ 
=== "<2>"

diff --git a/chapter_tree/binary_tree_traversal.md b/chapter_tree/binary_tree_traversal.md
index 9b56313f6..28144247d 100755
--- a/chapter_tree/binary_tree_traversal.md
+++ b/chapter_tree/binary_tree_traversal.md
@@ -16,8 +16,6 @@ comments: true

-
Fig. 二叉树的层序遍历
-
### 算法实现
广度优先遍历一般借助「队列」来实现。队列的规则是“先进先出”,广度优先遍历的规则是 ”一层层平推“ ,两者背后的思想是一致的。
@@ -258,8 +256,6 @@ comments: true

-
Fig. 二叉树的前 / 中 / 后序遍历
-
| 位置 | 含义 | 此处访问结点时对应 |