Question: In C++, implement a Linked List-based Stack called LinkedListStack. When the stack is full, its size can grow as elements are inserted into the stack.
In C++, implement a Linked List-based Stack called LinkedListStack. When the stack is full, its size can grow as elements are inserted into the stack. Use the template Stack.h to create LinkedListStack using templates for Linked List, filling in all of the member functions. Another class for nodes will need to be created as well. Your code should be able to be complied and LinkedListStack should be a .h file. fill in all member functions just as they appear in Stack.h. Use names given in Stack.h. LinkedListStack.h should start like this:
#ifndef LinkedListStack_h #define LinkedListStack_h #include "Stack.h" #include template class LinkedListStack : public AbstractStack {...};#endif
Use this as a template and and to know what member functions need to be created
Stack.h
#ifndef ABSTRACT_STACK_H #define ABSTRACT_STACK_H #include using namespace std; template class AbstractStack { private: // data goes here public: AbstractStack(void) {} ~AbstractStack(void) {} bool isEmpty(void) {} int size(void) {} Type top() throw(exception) {} Type pop() throw(exception) {} void push ( Type e ) {} }; #endif
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
