/*
Name: Anne Dawson
Program: binaryHeap.h
Description: This is the declaration of the heap class.
*/



// Class Invariants:
// Min heap is implemented as an array based on the following rules:
// First node of the heap is in position "0" of the array. Then the node k has
// left child in 2*k+1 (array index)
// right child in 2*k+2 (array index)
// parent in int((k-1)/2) (array index)
// pointer m_array will point to the heap data
// default size of array is 50
// m_size is the current number of items in the heap
// m_capacity is the maximum size of the array (heap)

#ifndef _BINARYHEAP_H_
#define _BINARYHEAP_H_

template< typename type >
class CBinaryHeap
{
public:
CBinaryHeap( void );
// Post: binary heap has default capacity 50 and heap is empty

CBinaryHeap( int maxCapacity );
// Post: maxCapacity is the capacity of the heap and the heap is empty

CBinaryHeap( const CBinaryHeap< type >& otherHeap );
// Post: this heap is a copy of otherHeap

~CBinaryHeap( void );
// Post: memory allocated to heap has been released

CBinaryHeap< type >& operator=( const CBinaryHeap< type >& otherHeap );
// Post: this heap has been assigned the value of otherHeap

void makeEmpty( void );
// Post: heap is empty

void insert( const type& item );
// Pre: heap is not full
// Post: item has been inserted into heap

void deleteTop( void );
// Pre: heap is not empty
//Post: item at top of heap has been removed

type& getTop( void );
// Pre: heap is not empty
// Post: reference to item at top of heap has been returned

const type& getTop( void ) const;
// Pre: heap is not empty
// Post: constant reference to item at top of heap has been returned
int size(void ) const;
// Post: number of elements in heap has been returned

bool isFull( void ) const;
// Post: true if heap is full, false otherwise

bool isEmpty( void ) const;
// Post: true if heap is empty false otherwise

void print(void) const;
//for display and debugging purposes

private:


type* m_array;                      // array to hold data in heap
int m_capacity;                     // maximum capacity of heap
int m_size;                         // number of items in heap

};

#include "binaryHeap.cpp"

#endif
