Would you prefer DFS or BFS for this problem? Why?
  • If we were just running vanilla DFS (no pruning or loop checking) then we would prefer BFS, because DFS could get stuck in an infinite loop. Note that DFS is sensitive to the ordering of the nodes. If it explores to the left first it will get stuck in the loop, whereas if it explores to the right first it will find the goal very quickly.

Valid HTML 4.0 Transitional