![]() |
Data Abstraction and Problem Solving with C++Walls and Mirrorsby Frank M. Carrano |
![]() |
Heap.hGo to the documentation of this file.00001 00017 const int MAX_HEAP = maximum-size-of-heap; 00018 00019 #include "HeapException.h" 00020 #include "KeyedItem.h" // definition of KeyedItem 00021 00022 typedef KeyedItem HeapItemType; 00023 00026 class Heap 00027 { 00028 public: 00029 Heap(); 00030 // copy constructor is supplied by the compiler 00031 virtual ~Heap(); 00033 // Heap operations: 00034 00040 virtual bool heapIsEmpty() const; 00041 00047 virtual void heapInsert(const HeapItemType& newItem) 00048 throw(HeapException); 00049 00056 virtual void heapDelete(HeapItemType& rootItem) 00057 throw(HeapException); 00058 00059 protected: 00061 void heapRebuild(int root); 00062 00063 private: 00064 HeapItemType items[MAX_HEAP]; 00065 int size; 00066 }; // end Heap 00067 // End of header file. |