Embed presentation
Download to read offline


![1. Insertion(a,top,item,max)
2. If top=max then
print ‘STACK OVERFLOW’
else
3. Set top=top+1
4. Set stack[TOP]=item
5. end](https://image.slidesharecdn.com/dsppt-141121224848-conversion-gate01-231111061124-4815d5b4/85/dsppt-141121224848-conversion-gate01-pptx-3-320.jpg)
![1. Deletion(a,top,item)
2. If top=0 then
print ‘STACK UNDERFLOW’
3. item=stack[top]
4. top=top-1
5. Exit](https://image.slidesharecdn.com/dsppt-141121224848-conversion-gate01-231111061124-4815d5b4/85/dsppt-141121224848-conversion-gate01-pptx-4-320.jpg)



This document describes algorithms for insertion and deletion operations on a stack data structure. It includes pseudocode for inserting an item at the top of the stack if it is not full, deleting the top item if the stack is not empty, and a procedure to check if the stack is empty by checking if the top pointer is less than 1. The document is submitted by Kanta Anuraga Sahoo and thanks the reader at the end.


![1. Insertion(a,top,item,max)
2. If top=max then
print ‘STACK OVERFLOW’
else
3. Set top=top+1
4. Set stack[TOP]=item
5. end](https://image.slidesharecdn.com/dsppt-141121224848-conversion-gate01-231111061124-4815d5b4/85/dsppt-141121224848-conversion-gate01-pptx-3-320.jpg)
![1. Deletion(a,top,item)
2. If top=0 then
print ‘STACK UNDERFLOW’
3. item=stack[top]
4. top=top-1
5. Exit](https://image.slidesharecdn.com/dsppt-141121224848-conversion-gate01-231111061124-4815d5b4/85/dsppt-141121224848-conversion-gate01-pptx-4-320.jpg)


