Array based heap. Please Help!
I've searched all over google and wikipidea and cannot come up with the information I need. Does anyone know how to show the heap that would be used to store the words: this, is, the, house, that, jack, built, assuming they are inserted in sequence given? And then I have to exchange the order of the arrival of the first and last words and build and show the new heap.
Thanks
[390 byte] By [
Toad333a] at [2007-11-27 3:37:42]

This is just an array thing:
String[] words = new String[length_of_array];
For insertions search the list and insert it where it goes. This involves shifting every element after it to the right, which is why good heap implementations are tree-based.
Reversal involves swapping words[0] with words[length-1], words[1] with words[length-2] etc...
> This involves shifting every element after it to the right, which is why good heap implementations are tree-based.Um, a heap tree can be implemented in an array. I don't think you understand the partially ordered datastructure.