Blue cells: nodes expanded. Orange line: path found. Arrows: one-way lanes the search must obey.
Orders the queue by g(n) + h(n), where h is the Manhattan distance to the goal. h never overestimates, so A* is still optimal.
| Algorithm | Expanded | Cost |
|---|---|---|
| BFS | - | - |
| Dijkstra | - | - |
| A* | - | - |
All three find the same optimal cost. The heuristic is what lets A* skip most of the floor.