Home »
MCQs »
Algorithms MCQs
What is the time complexity of Breadth-First Search (BFS) in a graph with ð‘‰V vertices and EE edges?
17. What is the time complexity of Breadth-First Search (BFS) in a graph with ð‘‰V vertices and EE edges?
- O(V^2)
- O(E + V)
- O(V + E)
- O(E * V)
Answer
The correct answer is: C) O(V + E)
Explanation
The time complexity of BFS is O(V + E) because it visits each vertex and each edge once.