Which of the following is a disadvantage of DFS?

Practice Questions

Q1
Which of the following is a disadvantage of DFS?
  1. It can get stuck in deep paths.
  2. It requires more memory than BFS.
  3. It cannot be implemented recursively.
  4. It is slower than BFS.

Questions & Step-by-Step Solutions

Which of the following is a disadvantage of DFS?
  • Step 1: Understand what DFS (Depth-First Search) is. It is a method for exploring a graph by going as deep as possible down one path before backtracking.
  • Step 2: Recognize that DFS explores one path completely before moving to another path.
  • Step 3: Identify that in some graphs, there may be long paths that lead to dead ends or nodes with no further connections.
  • Step 4: Realize that if DFS keeps going down these long paths, it can take a lot of time and resources without finding a solution.
  • Step 5: Conclude that this inefficiency in traversal, where DFS gets stuck in deep paths, is a disadvantage.
No concepts available.
Soulshift Feedback ×

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

Not likely Very likely