Embed presentation
Download to read offline













![Insertion(a, top, item, max)
If top = max then
print ‘STACK OVERFLOW’
exit
else
top = top+1
end if
a[top] = item
Exit
ALGORITHM OF INSERTION IN STACK: (PUSH)](https://image.slidesharecdn.com/dsstacks-211125022453/85/Ds-stacks-14-320.jpg)
![Deletion(a, top, item)
If top = 0 then
print ‘STACK UNDERFLOW’
exit
else
item = a[top]
end if
top = top-1
Exit
ALGORITHM OF DELETION IN STACK: (POP)](https://image.slidesharecdn.com/dsstacks-211125022453/85/Ds-stacks-15-320.jpg)


A data structure organizes data to be used effectively, storing it logically and defining retrieval mechanisms. A stack is a last-in, first-out collection where the last item added is the first removed. It is a linear data structure with operations at one end only. Basic stack operations include push to insert an item and pop to remove the top item. Stacks have applications in reversing strings, expression evaluation, recursion handling, checking parenthesis matching, and browser/editor undo functions.













![Insertion(a, top, item, max)
If top = max then
print ‘STACK OVERFLOW’
exit
else
top = top+1
end if
a[top] = item
Exit
ALGORITHM OF INSERTION IN STACK: (PUSH)](https://image.slidesharecdn.com/dsstacks-211125022453/85/Ds-stacks-14-320.jpg)
![Deletion(a, top, item)
If top = 0 then
print ‘STACK UNDERFLOW’
exit
else
item = a[top]
end if
top = top-1
Exit
ALGORITHM OF DELETION IN STACK: (POP)](https://image.slidesharecdn.com/dsstacks-211125022453/85/Ds-stacks-15-320.jpg)

