Java中的简单优先级队列

发布于 2024-10-03 23:28:46 字数 111 浏览 0 评论 0原文

谁能告诉我一种简单的方法来实现一个优先级队列,该队列只提供 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

且行且努力 2024-10-10 23:28:46

这是概念性问题而不是实现性问题,因此我建议您查看 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文