Pyqs of Data Structure - Stack For More Such Type of Questions and Detailed Video Explanation, Visit The Link
Pyqs of Data Structure - Stack For More Such Type of Questions and Detailed Video Explanation, Visit The Link
Pyqs of Data Structure - Stack For More Such Type of Questions and Detailed Video Explanation, Visit The Link
def Pop(St):
return St.pop()
St=[]
for i in R:
if R[i]>75:
Push(St,i)
while True:
if St!=[]:
print(Pop(St),end=' ')
else:
break
N=[12, 13, 34, 56, 21, 79, 98, 22, 35, 38]
def Push(St,N):
St.append(N)
def Pop(St):
return St.pop()
St=[]
for i in N:
if i%2==0:
Push(St,i)
print(St)
while True:
if St!=[]:
print(Pop(St),end=' ')
else:
break
def Push(St,N):
St.append(N)
def Pop(St):
return St.pop()
while True:
if St!=[]:
print(Pop(St),end=' ')
else:
break
def Push(St,N):
St.append(N)
def Pop(St):
return St.pop()
W=['Elucidate', 'Haughty', 'Pacify', 'Quip', 'Rapport',
'Urbane', 'Young','Zenith']
St=[]
for i in W:
if len(i)<7:
Push(St,i)
while True:
if St!=[]:
print(Pop(St),end=' ')
else:
break
def Push(N):
for i in N:
if 'A' in i:
OnlyA.append(i)
def Pop(OnlyA):
while True:
if OnlyA!=[]:
print((OnlyA.pop()),end=' ')
else:
break
print("Empty")
Names=['ANKITA', 'NITISH', 'ANWAR', 'DIMPLE', 'HARKIRAT']
OnlyA=[]
Push(Names)
Pop(OnlyA)
def pushEven(N):
for i in N:
if i%2==0:
EVEN.append(i)
def popEven(EVEN):
while True:
if EVEN!=[]:
print((EVEN.pop()),end=' ')
else:
break
print("Stack Empty")
N=[10,5,3,8,15,4]
EVEN=[]
pushEven(N)
popEven(EVEN)
def Push3_5(N):
for i in N:
if i%3==0 or i%5==0:
Only3_5.append(i)
NUM=[]
Only3_5=[]
for i in range(5):
a=int(input("Enter Number : "))
NUM.append(a)
print(NUM)
Push3_5(NUM)
while True:
if Only3_5!=[]:
print((Only3_5.pop()),end=' ')
else:
break
print("Stack Empty")
def Push_element(cust) :
if cust[2]=='Goa':
status.append(cust[0],cust[1])
def Push(Sitem):
for i in Sitem:
if Sitem[i] > 75:
stackitem.append(i)
print("Total elements in stack:",len(stackitem))
Ditem={"Pen":106,"Pencil":59,"Notebook":80,"Eraser":25}
Push(Ditem)