Question discussion

The time complexity of breadth-first search on a graph with V vertices and E edges stored as adjacency lists is

1928Medium DSSSB TGT Computer Science 0 replies 1 views
0

The time complexity of breadth-first search on a graph with V vertices and E edges stored as adjacency lists is

  • AO(V · E)
  • BO(V + E)
  • CO(V²)
  • DO(E log V)
Correct answer: B

Explanation

Each vertex is enqueued once and each adjacency list is scanned once, so the total work is O(V + E).

Discussion 0

Nobody has replied yet. Start the discussion!