Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LeetCode/481-490/488. 祖玛游戏(困难).md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

这是 LeetCode 上的 **[488. 祖玛游戏](https://leetcode-cn.com/problems/zuma-game/solution/gong-shui-san-xie-yi-ti-shuang-jie-sou-s-3ftb/)** ,难度为 **困难**。

Tag : 「DFS」、「搜索」、「启发式搜索」
Tag : 「DFS」、「搜索」、「启发式搜索」、「AStar 算法」



Expand Down
4 changes: 2 additions & 2 deletions LeetCode/671-680/675. 为高尔夫比赛砍树(困难).md
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ class Solution {

### AStar 算法

**由于问题的本质是求最短路,同时原问题的边权为 $1$,因此套用其他复杂度比 `01 BFS` 高的最短路算法,对于本题而言是没有意义,但运用启发式搜索 AStar 算法来优化则是有意义。**
**由于问题的本质是求最短路,同时原问题的边权为 $1$,因此套用其他复杂度比 `BFS` 高的最短路算法,对于本题而言是没有意义,但运用启发式搜索 AStar 算法来优化则是有意义。**

因为在 `01 BFS` 过程中,我们会无差别往「四联通」方向进行搜索,直到找到「当前树点的下一个目标位置」为止,而实际上,两点之间的最短路径往往与两点之间的相对位置相关。
因为在 `BFS` 过程中,我们会无差别往「四联通」方向进行搜索,直到找到「当前树点的下一个目标位置」为止,而实际上,两点之间的最短路径往往与两点之间的相对位置相关。

举个 🌰,当前我们在位置 $S$,我们目标位置是 $T$,而 $T$ 在 $S$ 的右下方,此时我们应当优先搜索方向"往右下方"的路径,当无法从"往右下方"的路径到达 $T$,我们再考虑搜索其他大方向的路径:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

这是 LeetCode 上的 **[847. 访问所有节点的最短路径](https://leetcode-cn.com/problems/shortest-path-visiting-all-nodes/solution/gong-shui-san-xie-yi-ti-shuang-jie-bfs-z-6p2k/)** ,难度为 **困难**。

Tag : 「图」、「图论 BFS」、「动态规划」、「状态压缩」
Tag : 「图」、「图论 BFS」、「动态规划」、「状态压缩」、「AStar 算法」



Expand Down Expand Up @@ -186,7 +186,7 @@ class Solution {

---

### AStar
### AStar 算法

显然,从 $state$ 到 $state'$ 的「理论最小修改成本」为两者二进制表示中不同位数的个数。

Expand Down