next up previous
Next: Up: Previous:

Analysis

O(V) Enqueue / Dequeue operations

each vertex is processed only once
O(E) total time scanning adjacency list

O(V+E) BFS running time worst case


next up previous
Next: Up: Previous: