mirror of
https://github.com/CyC2018/Interview-Notebook.git
synced 2026-10-26 21:13:43 +00:00
Update Leetcode 题解 - 搜索.md
文字校对。
This commit is contained in:
@@ -585,7 +585,7 @@ private void dfs(int r, int c, boolean[][] canReach) {
|
||||
|
||||
Backtracking(回溯)属于 DFS。
|
||||
|
||||
- 普通 DFS 主要用在 **可达性问题** ,这种问题只需要执行到特点的位置然后返回即可。
|
||||
- 普通 DFS 主要用在 **可达性问题** ,这种问题只需要执行到特定的位置然后返回即可。
|
||||
- 而 Backtracking 主要用于求解 **排列组合** 问题,例如有 { 'a','b','c' } 三个字符,求解所有由这三个字符排列得到的字符串,这种问题在执行到特定的位置返回之后还会继续执行求解过程。
|
||||
|
||||
因为 Backtracking 不是立即返回,而要继续求解,因此在程序实现时,需要注意对元素的标记问题:
|
||||
|
||||
Reference in New Issue
Block a user