Java中的简单优先级队列
谁能告诉我一种简单的方法来实现一个优先级队列,该队列只提供 extract_min、add 和 reduce 键,而不使用 Java 中的内置键。最好是尽可能高效,而且执行起来不难。请给我一个样品。先感谢您!
can anyone tell me an easy way to implement a priority queue that only offers extract_min, add, and reduce key without using the build-in one in Java. It is better to be as efficient as possible and not hard to implement. Please give me a sample. Thank you in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是概念性问题而不是实现性问题,因此我建议您查看 wiki 优先级队列 或堆页面或深入研究一些非常好的书籍,例如“算法简介” 。当您了解这些数据结构(以及其他算法)背后的逻辑时,用任何编程语言实现它们应该不是什么大问题。
It's rather conceptual problem than implementational one, so I suggest you to have a look at wiki Priority queue or heap pages or dive into some really great books, for instance "Introduction to algorithms". When you understand logic behind those data structures (and other algorithms as well) implementing them in any programming language shouldn't be a big deal.