A stack or LIFO (last in, first out) is an abstract data type that serves as a collection of elements, with two principal operations: push, which adds an element to the collection, and pop, which removes the last element that was added.
Insert new elements into the top of the Stack. Following image will explain it better:
Delete an element from the top of the stack. Following image will explain it better:
void push(T elem);
void Stack<T>::push(T elem)
Complexity: O(1) for all of the above operations