Question: Consider the following Queue class that uses linked list to construct a Queue. class Node; typedef Node* NodePtr; class Node { public: int number; NodePtr

Consider the following Queue class that uses linked list to construct a Queue.

class Node; typedef Node* NodePtr;

class Node { public: int number; NodePtr next; Node(){number=0; next=NULL;} Node(int n){number=n; next=NULL;} }; //----------------------------------------

class Queue { private: NodePtr top; int currSize; const int fullSize;

public: //initalizez the Queue to an empty Queue (fixed size of 5) Queue() { fullSize= 5; currSize= 0; top= NULL; }

//initializes the Queue to an empty Queue and specific maximum size Queue(int maxSize) { fullSize= maxSize; currSize= 0; top = NULL; }

int enqueue(int item); //places an item into the Queue. Returns -1 if operation is not successful int dequeue(int& item); //removes an item from the Queue. Returns -1 if operation is not successsful bool empty(); //checks if the Queue is empty bool full(); //checks if the Queue is full };

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!