🗺️ Grid BFS — Grid Shortest Path
USACO C++ Book · Interactive Visualizer
🗺️ Grid BFS — Grid Shortest Path Full Demo
Grid BFS
O(R×C)
Step 0/14
📊 Grid (S=start, E=end, #=wall, number=BFS distance)
🗂 Data Structures
BFS Queue
Current Cell
Time:
O(R×C)
Space:
O(R×C)
💻 Code
Hint
Click
Next Step ▶
to start and observe how BFS expands layer by layer, guaranteeing the shortest path in an unweighted grid.
◀ Prev
Next Step ▶
↺ Reset
0/14
Keyboard:
→
Next
←
Prev
R
Reset