Is there a Heap in java?

后端 未结 6 1992
一整个雨季
一整个雨季 2021-01-31 13:00

I am porting a C++ library to Java and I need a heap data structure. Is there a standard implementation or will I need to do it myself?

6条回答
  •  孤街浪徒
    2021-01-31 13:50

    PriorityQueue uses a heap. Based on the oracle documentation at https://docs.oracle.com/javase/8/docs/api/java/util/PriorityQueue.html it seems likely that it is an implementation of a binary heap. I don't think there is an official implementation of a fibonacci or pairing heap, though I'd love to see either one of the two available.

提交回复
热议问题