java - Greedy Best First Search 使用队列还是堆栈?

标签 java algorithm stack queue greedy

我只是想实现最佳优先搜索,我不确定该算法是否有任何 LIFO 或 FIFO 属性。如果是这样,我应该使用哪一个?我需要使用它吗?

最佳答案

参见 http://en.wikipedia.org/wiki/Best-first_search#Algorithm_.5B3.5D对于这个伪代码:

OPEN = [initial state]
while OPEN is not empty or until a goal is found
do
 1. Remove the best node from OPEN, call it n.
 2. If n is the goal state, backtrace path to n (through recorded parents) and return path.
 3. Create n's successors.
 4. Evaluate each successor, add it to OPEN, and record its parent.
done

第 1 步说“删除最佳节点”- 这意味着使用 Priority Queue .

关于java - Greedy Best First Search 使用队列还是堆栈?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13424488/

相关文章:

java - 将mysql数据库连接到jsp

python - 检查 python 函数从 codewars 中确定等值线图

algorithm - 浮点分频器硬件实现细节

tcp - 如何将 lwIP tcp/ip 堆栈与微 Controller stm32f4(客户端)一起使用

java - 堆栈不断弹出相同的元素

java - 基本 Java 数组列表

java - 如何使用反射在运行时创建新的音乐播放器屏幕?

java - 一般套接字问题 - 将 C++ 结构从 Java 转移到 C++

algorithm - 根据过去发生的事件预测下一个事件的发生

Linux AT&T 命令行参数