// This is the heap interface from p. 214 of the text, // with the following changes: // The isFull and isEmpty methods have been removed // The array name has been changed // Appropriate compiler directives are included, // including one to include "a3.cpp" // (you may remove this if you want). // To facilitate inheritance, the private methods // of the text have been made protected, and the // "percolateDown" method has been made virtual. // You don't have to worry about this if you // aren't using inheritance. #ifndef ___HEAP #define ___HEAP #include using namespace std; template class BinaryHeap { public: explicit BinaryHeap(int capacity=100); const Comparable& findMin() const; void insert(const Comparable&); void deleteMin(); // make virtual? void deleteMin(Comparable &); void makeEmpty(); protected: int currentSize; vector a; void buildHeap(); virtual void percolateDown(int hole); }; #include "heap.cpp" #endif