Skip to content

Commit

Permalink
update content
Browse files Browse the repository at this point in the history
  • Loading branch information
labuladong committed Jun 20, 2023
1 parent 6bbdd79 commit 7cd1ea3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion 算法思维系列/BFS框架.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ BFS 相对 DFS 的最主要的区别是:**BFS 找到的路径一定是最短

本文就由浅入深写两道 BFS 的典型题目,分别是「二叉树的最小高度」和「打开密码锁的最少步数」,手把手教你怎么写 BFS 算法。

## 一、算法框架
### 一、算法框架

要说框架的话,我们先举例一下 BFS 出现的常见场景好吧,**问题的本质就是让你在一幅「图」中找到从起点 `start` 到终点 `target` 的最近距离,这个例子听起来很枯燥,但是 BFS 算法问题其实都是在干这个事儿**,把枯燥的本质搞清楚了,再去欣赏各种问题的包装才能胸有成竹嘛。

Expand Down
4 changes: 2 additions & 2 deletions 算法思维系列/双指针技巧.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ ListNode deleteDuplicates(ListNode head) {
> note:这里可能有读者会问,链表中那些重复的元素并没有被删掉,就让这些节点在链表上挂着,合适吗?
>
> 这就要探讨不同语言的特性了,像 Java/Python 这类带有垃圾回收的语言,可以帮我们自动找到并回收这些「悬空」的链表节点的内存,而像 C++ 这类语言没有自动垃圾回收的机制,确实需要我们编写代码时手动释放掉这些节点的内存。
不过话说回来,就算法思维的培养来说,我们只需要知道这种快慢指针技巧即可。
>
> 不过话说回来,就算法思维的培养来说,我们只需要知道这种快慢指针技巧即可。
**除了让你在有序数组/链表中去重,题目还可能让你对数组中的某些元素进行「原地删除」**

Expand Down

0 comments on commit 7cd1ea3

Please sign in to comment.