Professional Documents
Culture Documents
2
Push 9 9
operation 4 4 4
56 56 56 56
24 24 24 24 24
Push Push Push Push Push Stack
24 56 4 9 2 overflow
2
Pop 9 9
operation 4 4 4
56 56 56 56
24 24 24 24 24
Pop Pop Pop Pop Pop Stack
underflow
Stack Overflow: It tries to a situation , when one tries to push
an element in stack, that is full .(Stacks are list implemented ,
since list can grow, overflow condition does not arise until all
memory is exhausted.
Stack Underflow : It refers to a situation when one tries to pop
an item from an empty stack .
def POP(Arr):
if Arr == []:
print("Stack is empty…Stack Underflow")
else:
print("Deleted element is :",Arr.pop())
def MakePush(Package):
a=input(“Enter package title :”)
Package.append(a)
def MakePop(Package):
if Package == []:
print("Stack is empty...Underflow case...")
else:
print("Deleted element is :", Package.pop())