Question: #include #include #include using namespace std; class Student{ char name[45]; int priority; }; class BinaryHeap { private: vector heap; int left(int parent); int right(int parent);

#include #include #include using namespace std;

class Student{ char name[45]; int priority; }; class BinaryHeap { private: vectorheap; int left(int parent); int right(int parent); void heapifup(int index); void heapifdown(int index); public: BinaryHeap() {} ~BinaryHeap(){} void Insert(Student element); void DeleteMin(); int ExtractMin(); void DisplayHeap(); int size(); int Size(); }; int BinaryHeap::Size() { return heap.size(); }

void BinaryHeap::insert(Student element) { heap.push_back(element); heapifup(heap.size()-1); }

void BinaryHeap::DeleteMin() { if(heap.size()==0) { cout

int BinaryHeap::ExtractMin() { if(heap.size()==0) { return-1; } else return heap.font(); }

void BinaryHeap::print() { vector::iterator pos=heap.begin(); cout "; while(pos!=heap.end()) { coutnamepriority

void BinaryHeap::Peek() { vector::iterator pos = heap.begin(); coutnamepriority

int BinaryHeap::left(int parent) { int l=2*parent; if(l

int BinaryHeap::right(int parent) { int r = 2* parent+1; if ( r

void BinaryHeap::heapifyup(int n) { if (in >= 0 && parent(in) >= 0 && heap[parent(in)] > heap[in]) { int temp = heap[in]; heap[in] = heap[parent(in)]; heap[parent(in)] = temp; heapifyup(parent(in)); } } void BinaryHeap::heapifdown(int n) { int child = left (in); int child = right (in); if (child >= 0 && child >= 0 && heap[child] > heap[childl]) { child = childl; } if (child > 0 && heap [in] > heap [child]) int temp = heap[in]; heap[in] = heap[child]; heap[child] = temp; heapifydown(child);

} }

int main() { BinaryHeap h; student s; while (1) { cout>choice; switch(choice) { case 1 ; cout>element->name; cout> element->priority; h.Insert(element); break; case 2; h.Delete(); break; case 3; cout

I have few errors:

#include #include #include using namespace std; class Student{ char name[45]; int priority;

}; class BinaryHeap { private: vectorheap; int left(int parent); int right(int parent);

please fix errors of the program amd also include output of the program.

prog.cpp: 34:40 error: no void BinaryHeap::insert (Student) member function declared in class void BinaryHeap: insert (Student element prog.cpp: In member function void BinaryHeap: DeleteMin. prog.cpp:49:28: error: qualified-id in declaration before token void BinaryHeap DeleteMin

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 Databases Questions!