Sir, can you explain me the time complexity of BFS using adjacency list?
Time Complexity Of BFS
You go to each node only once. (remember we keep visited array, thus never go to a node again)
1 Like
Okay, and then in the worst case we are checking for each edge if node is visited, that’s why O(v+e) right?
Yeah right…