What is the time complexity of BFS when implemented on an adjacency list representation of a graph?

  • O(E)
  • O(V * E)
  • O(V + E)
  • O(V)
The time complexity of BFS on an adjacency list representation of a graph is O(V + E), where V is the number of vertices and E is the number of edges. BFS visits each vertex and edge once, making it a linear-time algorithm with respect to the size of the graph.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *