Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bb350be

Browse files
committed
Reworded.
1 parent c2a74a9 commit bb350be

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,6 @@ You can skip the more difficult problems and do them later.
121121
- [752. Open the Lock](en/1-1000/752-open-the-lock.md) was solved in _Python_ and 2 ways.
122122

123123
# Others
124-
- [433. Minimum Genetic Mutation](en/1-1000/433-minimum-genetic-mutation.md) was solved in _Python_.
124+
- [433. Minimum Genetic Mutation](en/1-1000/433-minimum-genetic-mutation.md) was solved in _Python_ and 2 ways.
125125

126126
More LeetCode problems will be added soon.

en/1-1000/752-open-the-lock.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,12 @@ We can think of this problem as a shortest path problem on a graph: there are `1
6969

7070
**Breadth-First Search** treats each vertex equally, which inevitably leads to poor performance.
7171

72-
**A-Star Algorithm** calculates the **distance** between each `vertex` and the `target vertex`, and prioritizes vertices with close distances, which greatly improves performance.
72+
The `A* (A-Star) algorithm` calculates the **distance** between each `vertex` and the `target vertex`, and **prioritizes vertices with closer distances**, which is equivalent to indicating which vertex to process next, so the performance is greatly improved!
7373

7474
#### A* (A-Star) Algorithm Has Two (or Three) Key Actions
7575
1. Use `priority_queue`.
7676
2. The function for calculating `distance` should be **carefully designed** (poor design will lead to **subtle** errors in the results).
77-
3. In special cases, simply using `distance` as the sorting basis for `priority_queue` is not enough, and you need to **make some adjustments**, such as adding it to the `step_count` variable value (not involved in this example).
77+
3. In special cases, simply using `distance` as the sorting basis of `priority_queue` is not enough, and it is also necessary to **adjust** (for example, add it to the `number of steps` variable value) to make the last few steps accurate (not involved in this example, yet in this one [1197. Minimum Knight Moves](https://leetcode.com/problems/minimum-knight-moves/)).
7878

7979
## Complexity
8080
> `N` is the length of `deadends`.

zh/1-1000/752-open-the-lock.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,14 @@
7070

7171
`广度优先搜索` 对每一个顶点都同等对待,这样难免性能会差。
7272

73-
`A* (A-Star) 算法` 会对每一个`顶点``目标顶点`**距离**进行计算,**距离近的顶点优先处理**性能提升会很大。
73+
`A* (A-Star) 算法` 会对每一个`顶点``目标顶点`**距离**进行计算,**距离近的顶点优先处理**相当于为下一步处理哪个顶点指明了方向,因此性能有很大的提升!
7474

7575
#### A* (A-Star) 算法的两(三)个关键动作
7676
1. 要用 `priority_queue`
7777
2. 计算距离的函数要**精心设计**。设计不好,将导致不易察觉的结果错误!
78-
3. 在特殊情况下,单纯地用`距离`作为`priority_queue`的排序依据还不够,还要**调整一下**比如与`步数`变量值相加(本例子不涉及)。
78+
3. 在特殊情况下,单纯地用`距离`作为`priority_queue`的排序依据还不够,还要**调整一下**比如与`步数`变量值相加),以使最后几步能精确(本例子不涉及,但这个例子 [1197. Minimum Knight Moves](https://leetcode.com/problems/minimum-knight-moves/) 涉及)。
7979

80-
## Complexity
80+
## 复杂度
8181
> `N``deadends.length`.
8282
8383
### 题解 1: 广度优先搜索

0 commit comments

Comments
 (0)