/* Extract-min*/ Node* Heap::extract() { /* O(lg n) */ if (isEmpty() == false) { Node *min = this->heap[0]; this->heap[0] = this->heap[this->size - 1]; this->size = this->size - 1; heapifydown(); return min; } return (Node*) 0; }
void NHeap<T>::deleteMin() { if(occupation>0) { heap[0]=heap[--occupation]; if((INITIALSIZE<occupation)&&(occupation<capacity/2)) resize(capacity/2); heapifydown(0); } }