Does anyone know the implementation details for the standard java priority queue? heap? skiplist?
Asked
Active
Viewed 3,804 times
2
-
Related thread - http://stackoverflow.com/questions/683041/java-how-do-i-use-a-priorityqueue – KV Prajapati Oct 20 '11 at 02:31
2 Answers
5
Javadoc says it's a heap: http://download.oracle.com/javase/6/docs/api/java/util/PriorityQueue.html
First sentence, first paragraph:
An unbounded priority queue based on a priority heap.

clstrfsck
- 14,715
- 4
- 44
- 59
-
1I was confused with priority heap a bit. if u look at the source code, it uses heapify method so balance the heap. so yeah it s the heap structure. it would be interesting to see a skiplist implementation. – DarthVader Oct 20 '11 at 02:34
-
1
1
Use the Source Luke: http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/687fd7c7986d/src/share/classes/java/util/PriorityQueue.java
Alse see this awesomely helpful answer explaining how to use the horrible web front end for Mercurial: Is it possible to browse the source of OpenJDK online?

Marc Bacvanski
- 1,458
- 4
- 17
- 33

MK.
- 33,605
- 18
- 74
- 111