Question: C++.Implement a Stack whose size can grow as elements are inserted into the stack. You will build three different implementations of this Stack. (Using templates

C++.Implement a Stack whose size can grow as elements are inserted into the stack. You will build three different implementations of this Stack. (Using templates for the type of object). Two of these implementations will be array-based. Each of these two should take an initial capacity for the stack in the constructor. The only difference between these implementations will be what happens when the Stack is full. For the first implementation, ArrayStack, you should increase the size of the array by a constant amount. For the second implementation, DoublingArrayStack, you should double the size of the array. Finally, for the third implementation, you should implement a Stack using a Linked List.

For the Linked List, implement another class for the nodes in the Linked List.

#ifndef ABSTRACT_STACK_H #define ABSTRACT_STACK_H 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

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!