Depth-First search in Python

后端 未结 4 1515
南笙
南笙 2021-02-06 13:37

I\'m trying to do a Depth-First search in Python but it\'s not working.

Basically we have a peg-solitaire board:

[1,1,1,1,1,0,1,1,1,1]

4条回答
  •  醉话见心
    2021-02-06 14:09

    It doesn't appear that you're creating new nodes, just re-using existing ones. DFS requires some kind of stack (either the call stack, or your own stack). Where is that?

提交回复
热议问题