Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

More Books

Students also viewed these Databases questions

Question

What is adverse impact? How can it be proved?

Answered: 1 week ago