Saturday, March 2, 2019

STACK ADT

 A Stack is a linear data structure which follows Last In First Out (LIFO) principles,in which both insertion and deletion occur at only one end of the list called the 'Top'.
                                  
Operations on Stack:                                                                     The fundamental operations performed on stack are

  1. Push
  2. Pop 

1. Push :                                                                                                       
       The process of inserting a new element to the top of the stack. for every push operation the top is incremented by one.


                                                 

2. Pop:                                                                                                                                                                            

   The process of  deleting an element from the top of the stack is called  pop operation .after every pop operation the top pointer is decremented by 1.         
                                   
                                                                       

 Exceptional condition:                    

  1. OverflowAttempt to insert an element when the stack is full is said to be overflow.  
  2. Underflow: Attempt to delete an element when the stack is empty is said to be underflow.
***************


No comments:

Post a Comment