I am trying to implement a Fibonacci Heap and I'm required to keep track of its nodes for subsequent operations. For the uninitiated, Fibonacci heap can be thought of as an m-degree tree or a collection of trees with a pointer to the maximum node in the structure. The tree structure takes a word and its frequency as an input and is required to give most frequently occurring words as the output. For example, Input:
Ann 31
Dustin 27
Ryan 43
Ashley 13
Sunday 23
Tuesday 19
2 //Output two top most occurring words in the tree
Output:
Ryan, Ann
My understanding of a hash table is very rudimentary. I input the word as the key and it gives out a hash value as output. How do I force this output to be a pointer to the corresponding node in the tree which stores its frequency? Also, given an input to find 'n' frequently occurring words, can I repeatedly remove the top node 'n' times and reinsert it back into the structure? Or am I better off keeping a sorted hash table?