DSA Studio
Search
Home
Sign in
Graph Traversal Basics
BFS/DFS on grids and components.
1. Which traversal guarantees shortest path in an unweighted graph?
BFS
DFS
Dijkstra
Topological sort
2. Grid problems usually use which neighbor directions?
3. When should you mark a node visited to avoid duplicates?
When enqueuing/pushing
When dequeuing/popping
After exploring all nodes
Never
4. If newColor equals the starting color in flood fill, the best action is:
Return immediately
Run DFS anyway
Invert all colors
Throw error
5. What data structure supports BFS order?
Submit quiz
Auto-advance on pass