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

Consider the following Stack class that uses linked list to construct the stack

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 Stack { private: NodePtr top; int currSize; const int fullSize;

public: //initializes the Stack to an empty Stack (fixed size of 5) Stack() { fullSize= 5; currsize= 0; top=NULL; } //initializes the Stack to an empty Stack and specific maximum size Stack(int maxSize) { fullSize= maxSize; currsize= 0; top= NULL; } int push(int item); //places an item into the stack. Returns -1 if operation is not successful int pop(int& item); //removes an item from the stack. Return -1 if operation is not successful bool empty(); //checks if the stack is empty bool full(); //checks if the stack 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!