Pathfinding
TimeO(E log V)SpaceO(V)
Grow a frontier outward from the start, always expanding the nearest unvisited cell. Each cell records its shortest distance; once the target is reached, trace the path back.
Key idea. Always expand the nearest unsettled node. A priority queue keeps that 'nearest' choice cheap — greedy, and provably shortest on non-negative weights.
1
Loading…
—