CS #ifndef QUEUE_H #define QUEUE_H template class Queue { struct Node { XXXXXXXXXXObject data; XXXXXXXXXXNode *prev; XXXXXXXXXXNode *next; XXXXXXXXXXNode( const Object & d = Object{ }, Node * p =...

Assignment attached.


CS #ifndef QUEUE_H #define QUEUE_H template class Queue { struct Node { Object data; Node *prev; Node *next; Node( const Object & d = Object{ }, Node * p = nullptr, Node * n = nullptr ) : data{ d }, prev{ p }, next{ n } { } Node( Object && d, Node * p = nullptr, Node * n = nullptr ) : data{ std::move( d ) }, prev{ p }, next{ n } { } }; public: Queue () { front = NULL; rear = NULL;} ~Queue() { while (front) deque(); } void enque(Object obj) { //write the code to and a passed object into the queue } Object deque() { // write the code that will remove a node from the queue. // make sure that your pointers are all correct and you permanently // delete the node in question. } Object frontNode() { //return the value of the first node } Object backNode() { //return the value of the last node. } private: Node * front; Node * rear; }; #endif // QUEUE_H Given an implementation of a queue called queue, which implements the basic queue functions, what values are in the queue after each chunk of code has completed running and what is output at the end. 4) queue.enqueue(15); queue.enqueue(65); queue.enqueue(50); queue.dequeue(); queue.enqueue(12); cout< queue.front();="" 5)="" queue.enqueue(1);="" queue.dequeue();="" queue.enqueue(65);="" queue.dequeue();="" queue.enqueue(50);="" queue.dequeue();="" queue.enqueue(12);="" queue.enqueue(10);="">< queue.front();="" 6)="" queue.enqueue(1);="" queue.enqueue(2);="" queue.enqueue(3);="" queue.enqueue(4);="" queue.enqueue(5);="" queue.enqueue(6);="" queue.enqueue(7);="" queue.dequeue();="">< queue.front();>
Oct 07, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here