Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started