InterviewStack.io LogoInterviewStack.io

Shortest Path and Pathfinding Algorithms Questions

Algorithms for finding shortest or optimal paths in graphs and grids, with emphasis on algorithm selection, correctness, and complexity. Include Dijkstra for non negative weighted graphs, Bellman Ford for graphs with possible negative edges and negative cycle detection, A Star search with admissible heuristics for informed pathfinding in grids and game maps, bidirectional search for speed improvements, and path reconstruction techniques. Cover differences between shortest path in unweighted versus weighted graphs, trade offs of heuristic design in A Star, typical grid and maze problem formulations, and practical applications such as game pathfinding, routing, and navigation.

MediumTechnical
48 practiced
You are building pathfinding for a strategy game with bridges, water penalties, and variable terrain costs. How would you design heuristics for A* that balance admissibility and informative power? Discuss approximations, hierarchical heuristics, and practical trade-offs when strict optimality is not required.
MediumTechnical
48 practiced
Compare Theta-star, Jump Point Search (JPS), and standard A* on uniform-cost grids. Explain how each algorithm modifies expansions, when each yields speedups, how optimality is affected, and relative implementation complexity. Give examples of map topologies favoring each algorithm.
HardSystem Design
64 practiced
For a graph with 1 billion nodes and edges distributed across many machines, propose a design to compute shortest paths or answer many point-to-point queries. Compare frameworks (Pregel/BSP, GraphX, Giraph), algorithms (parallel Dijkstra, delta-stepping), partitioning strategies, and how you would handle stragglers and machine failures.
HardTechnical
52 practiced
Prove that Dijkstra's algorithm returns correct shortest paths for graphs with non-negative edge weights. Then give a counterexample graph with a negative-weight edge that causes Dijkstra to fail, and explain which property of the algorithm is violated by negative weights.
MediumTechnical
49 practiced
Edge weights in your routing graph change frequently due to traffic. As an ML engineer responsible for route suggestions, propose an architecture for incremental shortest-path updates, caching strategies, and rules for when to recompute routes versus reuse cached results. Discuss latency, consistency, and user experience trade-offs.

Unlock Full Question Bank

Get access to hundreds of Shortest Path and Pathfinding Algorithms interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.