Question: Given the class definitions below, complete the code for the empty, swap and push functions.( thats Heap. Binary Heap. in data structure class by using

Given the class definitions below, complete the code for the empty, swap and push functions.( thats Heap. Binary Heap. in data structure class by using c++) 

#include #include using namespace std; class heapType{ 
 public: bool empty(); void push(int num); heapType(); 
 private: int C1I; int C2I; int CI; int done; // status flag int EOL; // end of line int count; // elements in the heap int heap[10]; 
 int PI; // parent index 

void swap(int I1,int I2); // exchange heap contents };

// ----------------------------------------------------- bool heapType::empty(){

 ... complete the code here ... 

} // ----------------------------------------------------- void heapType::swap(int I1,int I2){ // exchange heap contents

 ... complete the code here ... 

} // ----------------------------------------------------- void heapType::push(int num){

 ... complete the code here ... 
// child 1 index // child 2 index // child index 

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Algorithms Questions!