Greedy best-first search
Time complexity: O(E log V).
Result
Examples
How it works
Greedy best-first always moves to the cell that looks closest to the goal and ignores how far it has come. It is fast in open space but can take a long detour when a wall is in the way.
When to use it
Quick, good-enough routes where the shortest path is not required.
Other algorithms
Pathfinding Visualizer
- A* search
- Dijkstra's algorithm
- Breadth-first search (BFS)
- Depth-first search (DFS)
- Greedy best-first search