×

Multiple-Choice Questions

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?

  1. O(V^2)
  2. O(E + V)
  3. O(V + E)
  4. 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.

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.