DS & A(Stacks - Pointer Based)
| CHAPTER 13 | In the previous chapter, we talked about Array Based Stacks so continuing our discussion on Stacks, In this chapter, we will see how to implement pointer-based Stacks also known as Linked Stacks. Visual Representation: Properties of Linked Stack: Follows LIFO principle and all the other general properties of a stack. Unlike Array-based stack it's size is not fixed. Its size grows with the addition of new elements. A Linked Stack can have head and tail pointers but it is not mandatory. Stack ADT: template<typename e> class Stack{ public: //Function to insert a value at the pop of the Stack virtual bool push(const e& item) = 0; //Function to remove top-most Stack value virtual bool pop(e& item) = 0; //Function to Display the stack virtual void print() const= 0; }; Stack Implementation: Creating the Node: public: template<typename e>class Node { public: e element;