Two fundamental operations performed on the stack are PUSH and POP.  

push and pop operations in stack - Teachoo.png

Push Operation on Stack

PUSH adds a new element at the TOP of the stack. It is an insertion operation. 

We can add elements to a stack until it is full. A stack is full when no more elements can be added to it. Trying to add an element to a full stack results in an exception called ‘overflow’. 

Pop Operation on Stack

POP operation is used to remove the top most element of the stack, that is, the element at the TOP of the stack. It is a delete operation

We can delete elements from a stack until it is empty i.e. there is no element in it. Trying to delete an element from an empty stack results in an exception called ‘underflow’.

Go Ad-free
Davneet Singh's photo - Co-founder, Teachoo

Made by

Davneet Singh

Davneet Singh has done his B.Tech from Indian Institute of Technology, Kanpur. He has been teaching from the past 14 years. He provides courses for Maths, Science, Social Science, Physics, Chemistry, Computer Science at Teachoo.