Python 树/搜索类算法
2021-05-27 23:04
阅读:729
            
                         标签:color   bfs   code   add   队列   import   style   pytho   app    BFS:   Python 树/搜索类算法 标签:color   bfs   code   add   队列   import   style   pytho   app    原文地址:https://www.cnblogs.com/zk505zk/p/14807974.html
#1.设置队列
from queue import Queue
q = Queue()
#2.设置closed表
closed = set()/[]
#3.开始循环
while not q.empty():
    #取出
    a = q.get()
    #判断
    if a not in cloesd :
       #进入closed并进入下一步
       closed.add()/append()
       q.put()
评论
亲,登录后才可以留言!