Which structure for 0 and 1 weights?
Warm-up · Multiple choice · about 2 min
Every edge of a graph weighs 0 or 1. You need shortest distances from one source in O(V + E). Which structure holds the cells waiting to be processed?
Learn the idea first: 0-1 BFS and multi-source BFS, a visual lesson.
More 0-1 BFS and multi-source BFS problems
- Front or back of the deque Warm-up
- Rotting oranges Standard
- Minimum obstacle removal Standard
- Distance to the nearest 0 Standard