#include #include using namespace std; const int MAX_SIZE=100; /* Note the type ItemType needs to implement comparison operators */ template class Heap{ public: Heap(){ heapLength=0; } //Initialize the heap with the given data, and call build_heap to make it a heap Heap(ItemType initData[], int len); //return true if heap property is satisfied, false if violated bool IsHeap() { //Todo by you return true; //for now } /* precondition: * 1) heapLength>=i>1 * 2) node i's left subtree and right subtree meet the heap property, * node i might violate heap property, * postcondition: the subtree rooted at node i met heap property */ void heapify(int i); /* insert a new item into the heap. * Precondition: length+1 Heap::Heap(ItemType initData[], int len) { for (int i=0;i