Does java have an indexed minimum priority queue?

你离开我真会死。 提交于 2019-12-09 10:05:09

问题


I need it for an implementation of Dijkstra's algorithm, and I do have my own implementation but documenting my code would be easier with java's own classes.


回答1:


No, Java standard library has no such data structure. I think most people use this: http://algs4.cs.princeton.edu/24pq/IndexMinPQ.java.html




回答2:


What do you mean 'indexed'? Priority queue doesn't support indexing, unless it won't be queue any more.

Java supports standard Priority Queue like C++ STL. It can be found in java.util namespace as PriorityQueue.



来源:https://stackoverflow.com/questions/10346525/does-java-have-an-indexed-minimum-priority-queue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!