How to do an inverted heap implementation in JAVA?

Why is there no Fibonacci heap implementation in the Standard Java API?

  • Given the fact that Fibonacci heap provides better performance than PriorityQueue (http://en.wikipedia.org/wiki/Fibonacci_heap), why is there no Fibonacci class in Standard Java API ?

  • Answer:

    Fibonacci heaps are asymptotically faster than binary and binomial heaps, but this does not necessarily mean they are faster in practice. The additional complexity of Fibonacci heaps will likely make them slower for operations on smaller heaps. Additionally, the delete operation has worse worst case complexity. Many applications simply don't need the additional benefit of a Fibonacci heap and adding it bloats the size of the Java standard library for everyone. If your application really does need one, there are non-standard library implementations. People working on the standard library have other priorities to work on. The Java standard library is already very large and I expect takes quite a bit of effort to maintain. Every class they write adds to this burden.

Tim Wilson at Quora Visit the source

Was this solution helpful to you?

Other answers

To add to point #3 of - the PriorityQueue came along with JSR 166 Concurrency Utilities. This is based on Dr. Doug Lea's Java concurrent work which dates back to 1998 - http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/intro.html

Miguel Paraz

I know there is no Fibonacci heap in the standard Java API, but there are a few open-source ones. I did some experiment using Fibonacci heap based Priority Queue for the Dijkstra's algorithm. You can see how these open-source implementations perform during the execution of the algorithm. Here is the link for my blog post "https://gabormakrai.wordpress.com/2015/02/11/experimenting-with-dijkstras-algorithm/" and for the experiment's GitHub page "https://github.com/gabormakrai/dijkstra-performance".

Gábor Makrai

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.