90% Discount Hostinger Coupon 1CODERX53
896+ Capstone Project is Available: Whatsapp: +91-7011258995, Email: sharecodepoint@gmail.com

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.

Sharecodepoint

Sharecodepoint is the junction where every essential thing is shared for college students in the well-defined packets of codes. We are focused on providing you the best material package like Question papers, MCQ'S, and one NIGHT STUDY MATERIAL. facebook twitter youtube instagram

Post a Comment

Previous Post Next Post

Contact Form