Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

write the definition for the following functions in c++ format #ifndef PRIORITYQUEUE_H #define PRIORITYQUEUE_H #include struct PatientNode { std string name; int injurySeverity; int treatmentTime;

write the definition for the following functions in c++ format

#ifndef PRIORITYQUEUE_H #define PRIORITYQUEUE_H

#include

struct PatientNode { std string name; int injurySeverity; int treatmentTime; };

class PriorityQueue { public: /* class constructor Purpose: perform all operations necessary to instantiate a class object Parameter _queueSize: Maximum size of the priority queue return: none */ PriorityQueue(int _queueSize); ~PriorityQueue(); /* Method Name: enqueue Purpose: enqueue new patient into priority queue; call other method(s) as required to maintain heap Parameter: _name - name of patient to be entered in priority queue Parameter: _injurySeverity - severity of injury Parameter: _treatmentTime - time required for doctor to treat patient injury returns void */ void enqueue(std::string _name, int _injurySeverity, int _treamentTime); /* Method Name: dequeue Purpose: remove the patient at the front of the priority queue from the queue, call other method(s) as required to maintain heap Parameters: none return: void */ void dequeue(); /* Method Name: peekName Purpose: get name of patient at front of priority queue while maintaining encapsulation Parameters: none return: name of patient at the front of the priority queue */ std::string peekname(); /* Method Name: peekInjurySeverity Purpose: get injury severity of patient at front of priority queue while maintaining encapsulation Parameters: none return: injury severity of patient at the front of the priority queue */ int peekInjurySeveriyt(); /* Method Name: peekTreatmentTime Purpose: get treatment time of patient at front of priority queue while maintaining encapsulation Parameters: none return: treatment time of patient at the front of the priority queue */ int peekTreatmentTime(); /* Method Name: isFull Purpose: indicate if priority queue is full Parameters: none return: true if queue is full, false otherwise */ bool isFull(); /* Method Name: isEmpty Purpose: indicate if priority queue is empty Parameters: none return: true if queue is empty, false otherwise */ bool isEmpty();

private: /* Method Name: repairUpward Purpose: maintain heap properties by swapping node with parent if necessary Parameter nodeIndex - index of node that may violate heap properties return: void */ void repairUpWard(int nodelIndex); /* Method Name: repairDownward Purpose: maintain heap properties by swapping node with child if necessary Parameter: nodeIndex - index of node that may violate heap properties return: void */ void repairDownward(int nodelIndex);

PatientNode* prioriyQueue; //pointer to the array used to implement priority queue int currentQueueSize; //number of patients currently in priority queue int macQueueSize; //maximum capacity of priority queue };

#endif // PRIORITYQUEUE_H

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

Step: 3

blur-text-image

Ace Your Homework with AI

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

Get Started

Students also viewed these Databases questions

Question

1. What steps might you include or remove from this process?

Answered: 1 week ago