









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










i
i
Why I=n/2?
i
i
i
i
i
i
i
i
private:
int currentSize; // Number of elements in heap
eType array; // The heap array*
int capacity;
void percolateDown( int hole );
#include "Heap.h“
template
Heap
array = new etype[capacity + 1];
currentSize=0;
template
void Heap
if( isEmpty( ) ) {
return;
minItem = array[ 1 ];
array[ 1 ] = array[ currentSize-- ];
percolateDown( 1 );