Question
Need help completing the Enqueue, Dequeue, DisplayQueue, and FindNode method of the priority queue program below class Node { public: int priority; int data_value; Node*
Need help completing the Enqueue, Dequeue, DisplayQueue, and FindNode method of the priority queue program below
class Node {
public:
int priority;
int data_value;
Node* next;
};
class PriorityQueue{
public:
PriorityQueue(void) { head = NULL; } // constructor
~PriorityQueue(void); // destructor
bool IsEmpty() { return head == NULL; }
void Enqueue(int priority, int value)
// insert new node in priority queue
{}
Node* Dequeue()
// Dequeue first node from the Queue and return it
{}
void DisplayQueue(void)
// DisplayQueue
{}
int FindNode (int priority, int value)
// Return the index/position where a node with priority and value located in the Queue
{}
private:
Node* head;
};
int main ()
{
PriorityQueue P;
P.Enqueue(1,10);
P.Enqueue(1,12);
P.Enqueue(2,5);
P.Enqueue(2,4); P.Enqueue(3,5);
P.Enqueue(2,1);
P.DisplayQueue();
P.Dequeue();
P.Dequeue();
P.DisplayQueue();
return 0;
}
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