You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: en/1-1000/752-open-the-lock.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -69,12 +69,12 @@ We can think of this problem as a shortest path problem on a graph: there are `1
69
69
70
70
**Breadth-First Search** treats each vertex equally, which inevitably leads to poor performance.
71
71
72
-
**A-Star Algorithm** calculates the**distance** between each`vertex` and the`target vertex`, and prioritizes vertices withclose distances, whichgreatly improvesperformance.
72
+
The`A* (A-Star) algorithm` calculates the**distance** between each`vertex` and the`target vertex`, and**prioritizes vertices withcloser distances**, whichis equivalent to indicating which vertex to process next, so theperformance is greatly improved!
73
73
74
74
####A* (A-Star) Algorithm Has Two (or Three) Key Actions
75
75
1. Use`priority_queue`.
76
76
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 basisfor`priority_queue` is not enough, andyou needto**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 basisof`priority_queue` is not enough, andit is also necessaryto**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/)).