Quote:
|
Originally Posted by redhead
The value you're adding will determain where in teh tree it is going to be located, your seach tree here will always have values less than (or equal to) your value to add placed on the left branch, values higher placed on the right.
|
i understand that once i add it to the heap, i will need to 'reheapify' to make sure each parent is less than its child---
i plan to add the new entry to the next available location, maintaining the Complete Binary Tree property, but then it will not be a heap, so i will then re-heapify.
the problem arises when i try to find the next available place that will maintain the CBT. i can't seem to come up with the correct algorithm to do this using only count, height, and a pointer to the root node.