A* Search
7 min read.
An informed search algorithm that uses heuristics to guide the search. It guarantees the shortest path (if heuristic is admissible) and is usually much faster than Dijkstra.
Think of it this way: Think of driving with a GPS. It doesn't just look at road distance; it also estimates the remaining time to the destination (Heuristic) to guide you, avoiding paths that clearly lead away from the goal.
Start at (4,1), goal (4,11).
Check your understanding
Answer from memory before you scroll back up. Pulling an idea out of your head is what makes it stay there.
g, h, or f?
Sort each description into the part of f(n) = g(n) + h(n) it describes.
Tap a piece, then tap where it goes — or drag it. Tap the tray to take one back.
g(n) — cost so far
Drop items hereh(n) — heuristic
Drop items heref(n) — priority
Drop items hereQuiz
20 questionsWhat is the role of the Heuristic (h) in A*?
Done with this lesson?
Sign in free to keep your progress, streak and quiz scores.