mirror of
https://github.com/krahets/hello-algo.git
synced 2024-12-28 06:06:29 +08:00
build
This commit is contained in:
parent
ccd415c69a
commit
7f43facfd9
5 changed files with 6 additions and 6 deletions
|
@ -275,7 +275,7 @@ comments: true
|
||||||
在每次“尝试”中,我们通过将当前节点添加进 `path` 来记录路径;而在“回退”前,我们需要将该节点从 `path` 中弹出,**以恢复本次尝试之前的状态**。换句话说,**我们可以将尝试和回退理解为“前进”与“撤销”**,两个操作是互为相反的。
|
在每次“尝试”中,我们通过将当前节点添加进 `path` 来记录路径;而在“回退”前,我们需要将该节点从 `path` 中弹出,**以恢复本次尝试之前的状态**。换句话说,**我们可以将尝试和回退理解为“前进”与“撤销”**,两个操作是互为相反的。
|
||||||
|
|
||||||
=== "<1>"
|
=== "<1>"
|
||||||
![preorder_find_paths_step1](backtracking_algorithm.assets/preorder_find_paths_step1.png)
|
![尝试与回退](backtracking_algorithm.assets/preorder_find_paths_step1.png)
|
||||||
|
|
||||||
=== "<2>"
|
=== "<2>"
|
||||||
![preorder_find_paths_step2](backtracking_algorithm.assets/preorder_find_paths_step2.png)
|
![preorder_find_paths_step2](backtracking_algorithm.assets/preorder_find_paths_step2.png)
|
||||||
|
|
|
@ -203,7 +203,7 @@ comments: true
|
||||||
2. 将键值对 `num[i]` 和索引 `i` 添加进哈希表;
|
2. 将键值对 `num[i]` 和索引 `i` 添加进哈希表;
|
||||||
|
|
||||||
=== "<1>"
|
=== "<1>"
|
||||||
![two_sum_hashtable_step1](replace_linear_by_hashing.assets/two_sum_hashtable_step1.png)
|
![辅助哈希表求解两数之和](replace_linear_by_hashing.assets/two_sum_hashtable_step1.png)
|
||||||
|
|
||||||
=== "<2>"
|
=== "<2>"
|
||||||
![two_sum_hashtable_step2](replace_linear_by_hashing.assets/two_sum_hashtable_step2.png)
|
![two_sum_hashtable_step2](replace_linear_by_hashing.assets/two_sum_hashtable_step2.png)
|
||||||
|
|
|
@ -287,7 +287,7 @@ $$
|
||||||
遍历完成后,数组 `res` 中就是排序好的结果,最后使用 `res` 覆盖原数组 `nums` 即可。
|
遍历完成后,数组 `res` 中就是排序好的结果,最后使用 `res` 覆盖原数组 `nums` 即可。
|
||||||
|
|
||||||
=== "<1>"
|
=== "<1>"
|
||||||
![counting_sort_step1](counting_sort.assets/counting_sort_step1.png)
|
![计数排序步骤](counting_sort.assets/counting_sort_step1.png)
|
||||||
|
|
||||||
=== "<2>"
|
=== "<2>"
|
||||||
![counting_sort_step2](counting_sort.assets/counting_sort_step2.png)
|
![counting_sort_step2](counting_sort.assets/counting_sort_step2.png)
|
||||||
|
|
|
@ -24,7 +24,7 @@ comments: true
|
||||||
- 若 `cur.val = num` ,说明找到目标节点,跳出循环并返回该节点;
|
- 若 `cur.val = num` ,说明找到目标节点,跳出循环并返回该节点;
|
||||||
|
|
||||||
=== "<1>"
|
=== "<1>"
|
||||||
![bst_search_step1](binary_search_tree.assets/bst_search_step1.png)
|
![二叉搜索树查找节点示例](binary_search_tree.assets/bst_search_step1.png)
|
||||||
|
|
||||||
=== "<2>"
|
=== "<2>"
|
||||||
![bst_search_step2](binary_search_tree.assets/bst_search_step2.png)
|
![bst_search_step2](binary_search_tree.assets/bst_search_step2.png)
|
||||||
|
@ -620,7 +620,7 @@ comments: true
|
||||||
3. 用 `tmp` 的值覆盖待删除节点的值;
|
3. 用 `tmp` 的值覆盖待删除节点的值;
|
||||||
|
|
||||||
=== "<1>"
|
=== "<1>"
|
||||||
![bst_remove_case3_step1](binary_search_tree.assets/bst_remove_case3_step1.png)
|
![二叉搜索树删除节点示例](binary_search_tree.assets/bst_remove_case3_step1.png)
|
||||||
|
|
||||||
=== "<2>"
|
=== "<2>"
|
||||||
![bst_remove_case3_step2](binary_search_tree.assets/bst_remove_case3_step2.png)
|
![bst_remove_case3_step2](binary_search_tree.assets/bst_remove_case3_step2.png)
|
||||||
|
|
|
@ -651,7 +651,7 @@ comments: true
|
||||||
递归过程可分为“递”和“归”两个相反的部分。“递”表示开启新方法,程序在此过程中访问下一个节点;“归”表示函数返回,代表该节点已经访问完毕。如下图所示,为前序遍历二叉树的递归过程。
|
递归过程可分为“递”和“归”两个相反的部分。“递”表示开启新方法,程序在此过程中访问下一个节点;“归”表示函数返回,代表该节点已经访问完毕。如下图所示,为前序遍历二叉树的递归过程。
|
||||||
|
|
||||||
=== "<1>"
|
=== "<1>"
|
||||||
![preorder_step1](binary_tree_traversal.assets/preorder_step1.png)
|
![前序遍历的递归过程](binary_tree_traversal.assets/preorder_step1.png)
|
||||||
|
|
||||||
=== "<2>"
|
=== "<2>"
|
||||||
![preorder_step2](binary_tree_traversal.assets/preorder_step2.png)
|
![preorder_step2](binary_tree_traversal.assets/preorder_step2.png)
|
||||||
|
|
Loading…
Reference in a new issue