Answered step by step
Verified Expert Solution
Link Copied!

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to Data Mining

Authors: Pang Ning Tan, Michael Steinbach, Vipin Kumar

1st edition

321321367, 978-0321321367

More Books

Students also viewed these Algorithms questions