Stack
Stack is a linear data structure which follows a particular order in which the operations are performed. The order may be LIFO(Last In First Out) or FILO(First In Last Out). In stack, all insertion and deletion are permitted at only one end of the list.
Stack Operations:
- push(): When this operation is performed, an element is inserted into the stack.
- pop(): When this operation is performed, an element is removed from the top of the stack and is returned.
- top(): This operation will return the last inserted element that is at the top without removing it.
- size(): This operation will return the size of the stack i.e. the total number of elements present in the stack.
- isEmpty(): This operation indicates whether the stack is empty or not.