小编Shr*_*kar的帖子

在什么意义上 DFS 比 BFS 快?

在阅读有关 DFS 与 BFS 的文章时,我发现 DFS 比 BFS 更快,并且需要更少的内存。

我的实现都是用 C++ 实现的,为 DFS 制作一个堆栈,为 BFS 制作一个队列。有人可以解释一下,速度和内存要求有何不同?

graph-theory breadth-first-search depth-first-search data-structures

4
推荐指数
1
解决办法
6141
查看次数