Why is Depth-First Search said to suffer from infinite loops?

后端 未结 2 1369
栀梦
栀梦 2021-01-17 14:38

I have read about DFS and BFS many times but I have this doubt lingering my mind since long. In a lot of articles it is mentioned that DFS can get stuck in infinite loops.

2条回答
  •  感动是毒
    2021-01-17 15:17

    a conventional DFS algorithm does track down nodes. A local search algorithm does not track down states and behaves with amnesia. So I think the loop mainly refers to the one an infinite branch(a branch with infinite possible states). In that case, DFS simply goes down and become too focused on one branch.

提交回复
热议问题