Skip to content

Instantly share code, notes, and snippets.

@zaveri
Created April 19, 2010 19:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zaveri/371450 to your computer and use it in GitHub Desktop.
Save zaveri/371450 to your computer and use it in GitHub Desktop.
class BinaryHeap
{
public:
explicit BinaryHeap(int capacity = 100);
explicit BinaryHeap(const vector<char> & items);
bool isEmpty( ) const;
const char & findMin( ) const;
void insert(char s);
void deleteMin( );
void deleteMin( char & minItem );
void makeEmpty( );
private:
int currentSize; // Number of elements in heap
vector<char> array; // The heap array
void buildHeap( );
void percolateDown( int hole );
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment