Graph Traversal: BFS and DFS - Complexity Analysis - Competitive Exam Level

Download Q&A
Q. If a graph is represented using an adjacency matrix, what is the time complexity of BFS?
  • A. O(V + E)
  • B. O(V^2)
  • C. O(E)
  • D. O(V log V)
Q. What is the primary disadvantage of using DFS?
  • A. It cannot handle cycles
  • B. It may get stuck in deep paths
  • C. It is slower than BFS
  • D. It requires more memory
Q. What is the space complexity of BFS in a graph with V vertices?
  • A. O(V)
  • B. O(E)
  • C. O(V + E)
  • D. O(1)
Q. What is the worst-case time complexity of DFS for a graph represented as an adjacency list?
  • A. O(V + E)
  • B. O(V^2)
  • C. O(E)
  • D. O(V log V)
Q. Which traversal method is guaranteed to visit all vertices in a connected graph?
  • A. BFS
  • B. DFS
  • C. Both BFS and DFS
  • D. Neither BFS nor DFS
Showing 1 to 5 of 5 (1 Pages)
Soulshift Feedback ×

On a scale of 0–10, how likely are you to recommend The Soulshift Academy?

Not likely Very likely