Download New Sharecodepoint Android App from Google Play Store : DocScannerPoint : Document Scanner with OCR, PDF: Download Now


Domyhomework123.com - programming homework help. Get your programming homework done with expert homework helper. Trust Writemypaper123.com with your paper and you will never regret it.

Download Latest Notes, Study Materials and More...

Visit: Download Now


Ask Any Question Relative to your Sujbect

Visit: Ask Question


Introduction to Stack - Push & Pop Operations

Introduction to Stack  - Push & Pop Operations

The stack is a storage device that is used to store information in the manner of LIFO.LIFO stands for Last In First Out. The stack is a collection of objects. The Stack Pointer is a pointer that is used to represent the highest element of the stack and represented as SP. Stack has several applications in computer programming.

Stack has two operations:-

POP: POP operation is used to remove an item from the stack. Pop operations are used to retrieve an item that is present at the top of the stack.

PUSH: PUSH operation is an insertion operation that is used to store or insert an element at the top of the stack.

When an element is removed or inserted, the same operations will be performed only at the top element of the stack. When the top element is empty which is represented by MAXTERM then this is the condition of UNDERFLOW. And when the Maxterm is having an element then also we have to add one more element then the top is shifted towards upwards and this condition is known as OVERFLOW of the stack.

POP operation decreases the stack depth or length and PUSH operation increases the stack length. FIFO stack ensures that the data is retrieved in the same order in which it is entered. A stack is a recursive data structure.

Structural definition of a Stack:
* A stack is either empty.
* Stack has the top element on which PUSH & POP operations are performed.
* Stack has similar data types object list in an ordered format.
* Stack size is not fixed. It can be variable.
* Stack doesn't consume a fixed amount of memory.