0

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.

user92322
  • 29
  • 5

2 Answers2

2

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.

Louis Wasserman
  • 191,574
  • 25
  • 345
  • 413
  • Sorry. I don't get you. Fibonacci heap can use findmin(). Because the min is the root. Is there a Fibonacci heap that store max in root? – user92322 Oct 07 '16 at 21:07
  • Sure. It's exactly the one you get when you just change the `<` to `>` in the Fibonacci heap code and vice versa. – Louis Wasserman Oct 07 '16 at 21:16
0

Instead of using min heaps in the structure, use max heaps.

tinkuge
  • 97
  • 1
  • 11