Machine-translated by Google. Questions are authored in English.
Top

Discussion

Which container implements the frontier of a depth first search?

  • A.A hash table indexed by state
  • B.A last in first out stack
  • C.A first in first out queue
  • D.A priority queue ordered by depth

Answer: B

Expanding the most recently generated node drives the search down one branch until it can go no further, which is depth first search, and it is often implemented by recursion rather than an explicit stack. A queue gives breadth first, and a priority queue on depth would simply reproduce breadth first. Hash tables are used for the explored set. The choice of container is the whole of the difference between the two fundamental strategies. A single measurement chosen to respond to the one asymmetry beats several that respond to shared behaviour.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.