What is a disadvantage of using BFS?

Practice Questions

Q1
What is a disadvantage of using BFS?
  1. It can be slower than DFS
  2. It requires more memory than DFS
  3. It cannot be used for cyclic graphs
  4. It is not suitable for unweighted graphs

Questions & Step-by-Step Solutions

What is a disadvantage of using BFS?
  • Step 1: Understand what BFS (Breadth-First Search) is. It explores all neighbors of a node before moving to the next level.
  • Step 2: Recognize that BFS uses a queue to keep track of nodes to explore next.
  • Step 3: Note that at each level of the graph, BFS stores all nodes in the queue.
  • Step 4: Realize that if the graph is wide (has many nodes at each level), the queue can become very large.
  • Step 5: Understand that this large queue means BFS requires more memory compared to DFS (Depth-First Search), which uses a stack and only stores nodes along the current path.
No concepts available.
Soulshift Feedback ×

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

Not likely Very likely