Question: Please help with C++ program which implements a priority queue data structure. Would like to understand more about how to fill in the code. Thank

Please help with C++ program which implements a priority queue data structure. Would like to understand more about how to fill in the code. Thank you.

#include // Include to use NULL, otherwise use nullptr #include #include "node.hpp"

template class PQ{ private: Node *head; // the pointer to the front of the list Node *tail; // the pointer to the back of the list int count;

public: // desc: Inializes a new, empty queue PQ();

// desc: Adds new data to the queue // param: data The data to add to the list // param: priority The priority assigned to this node // returns: void void enqueue(T &data, int priority);

// desc: Removes the front element form the queue // returns: void void dequeue(void);

// desc: Removes the value found at the front of the queue // returns: The data found at the front of the queue T get_front(void);

// desc: Checks if the queue is empty or not // returns: true is the queue is empty, false if not bool isEmpty(void);

// desc: Clears the queue // returns: void void clear(void);

// desc: Returns the number of elements in the queue // returns: The number of elements in the queue int get_count(void); };

template PQ::PQ() { head = NULL; tail = NULL; count = 0; }

template void PQ::enqueue(T &data, int priority) { Node *new_node = new Node(data, priority);

}

template void PQ::dequeue(void) { }

template T PQ::get_front() { }

template bool PQ::isEmpty() { }

template void PQ::clear(void) { }

template int PQ::get_count(void) { }

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!