javafibonacci-heap

Is FibonacciHeap a min-heap? how to find max using FibonacciHeap?


My Java project is to use Max Fibonacci heap to find top nth most popular hashtags. The record can be like this:

#saturday 5 
#sunday 3 
#saturday 10 
#monday 2 
#reading 4 
#playing_games 2
3

But Fibonacci heap only have find min function. What is the difference between 'Fibonacci heap', 'Min Fibonacci heap' and 'Max Fibonacci heap' ?

My idea is to use function extractmax() n times to get the top n. but I don't know what is Max Fibonacci heap.


Solution

  • Switching between min and max heaps is trivial, you just change the comparator. A heap is a heap, whichever direction it's working in, the algorithm doesn't change.

    Finding the maximum element is just finding the minimum element except you change the ordering.