What is the time complexity of Breadth-First Search (BFS)?
What is the time complexity of Breadth-First Search (BFS)?
Approach: Analyze visits to vertices and edges.
O(V + E), where V is the number of vertices and E is the number of edges. Each vertex and edge is processed at most once.
Follow-up: What data structure is typically used for BFS?
Key concepts: queue, adjacency list.