# Federico Mengozzi

A new slightly improved version

# Improving the Fibonacci Heap

Add a nodes pool and make it mergeable

Since my old post on the fibonacci-heap I made a few changes in the structure, cleaned the code and I had the chances to perform some other tests.

The real improvement over the last version was creating a nodes pool instead of allocate a new node on every call to insert. The idea is to create a stack of pre-allocated node object (by default a stack of $1000$ nodes) and use them as they are needed. In addition, instead of deleting a node when it’s extracted, it’s sufficient to clear it and put it back in the stack.

To do this other utility methods are used

Another change in the structure was the possibility to add an ordering function for the structure. In this way was possible to have both a min-fibonacci heap and max-fibonacci heap with same implementation. Instead of directly compare the key of the node, now the compare function is used

Finally the merge method was implemented (really simple, it consists in merging the two root_list) and I also performed some refactor. The final version is below.