Question: Are based on the following Queue class code segment class QueueFull {/* Empty exception class */}; Class Queue Empty {/* Empty exception class */}; struct
Are based on the following Queue class code segment class QueueFull {/* Empty exception class */}; Class Queue Empty {/* Empty exception class */}; struct Node//Node structure int data;//Holds an integer Node* next;//Pointer to next node in the queue}; Class Queue//Linked node implementation of Queue ADT {Private: Node* front;//Pointer to front node of queue Node* rear;//pointer to last node of queue Public: Queue ()://default constructor initializes queue to be empty -Queue ();//Deallocates all nodes in the queue Void Add (int n);//Enqueues value n; if full, throws QueueFull exceprion int Remove ();//Dequeues and returns next value from the queue//If empty, throws QueueEmpty exception bool IsFull() const;//Returns true If queue is full; return false otherwise bool IsEmpty () const;//Returns true if queue is empty; return false otherwise int size () const;//Returns number of data values stored in queue}; Which if any of the following code segments correctly implements the Queue constructor? Queue:: Queue () const Queue:: Queue () {{front = NULL; front = new Node; rear = NULL; rear = new Node;}} Void Queue:: Queue () const Queue:: Queue () {{front = NULL; Front = rear; rear = NULL; count = 0;} None of the answers provided which if any of the following code segments correctly implements the IS Empty method? bool Queue:: Is empty () const bool Queue:: Is Empty () {{return (front == rear); return (count = = 0);}} bool Queue:: Is Empty () bool Queue:: IsEmpty () const {{return (rear = = NULL); return (front == NULL);}} None of the answers provided
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
