【问题标题】:What will happen if in the Breadth-FirstSearch(BFS) algorithm a stack is used instead of queueq?如果在广度优先搜索(BFS)算法中使用堆栈而不是 queueq 会发生什么?
【发布时间】:2014-04-08 23:26:56
【问题描述】:

如果在广度优先搜索(BFS)算法中使用堆栈而不是 queueq 会发生什么?

pseudocode of BFS with queue:
    BFS(node)
    {
       queue <- node
       while queue not empty 
       v <-- queue
       print v
       for each child c of v quequ <-c
    }

【问题讨论】:

    标签: algorithm stack queue depth-first-search breadth-first-search


    【解决方案1】:

    在这种情况下,它变成了深度优先搜索

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-02-16
      • 1970-01-01
      • 2023-04-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多