|
|
@@ -56,9 +56,8 @@ void PriorityQueue::removeMax(){
|
|
|
} else {
|
|
|
// remove the max value (at root)
|
|
|
heapArray[1] = heapArray[heap_size + 1];
|
|
|
- heap_size--;
|
|
|
- // heapify down until the heap properties are restored
|
|
|
heapifyDown(1);
|
|
|
+ heap_size--; // causing that zero to appear?
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -106,6 +105,8 @@ void PriorityQueue::heapifyDown(int index){
|
|
|
|
|
|
if (largerKeyIndex != index) {
|
|
|
change(&heapArray[index], &heapArray[largerKeyIndex]);
|
|
|
+ // apparently heapArray[largerKeyIndex] doesn't have a value?!?! fix this later
|
|
|
+ std::cout << "when does zero appear? " << heapArray[largerKeyIndex] << std::endl;
|
|
|
heapifyDown(largerKeyIndex);
|
|
|
//heap_size--;
|
|
|
}
|