1.

Write a function in Python, INSERTQ(Arr,data) and DELETEQ(Arr) for performing insertion and deletion operations in a Queue. Arr is the list used for implementing queue and data is the value to be inserted.

Answer»

def INSERTQ(Arr):

data=int(input("enter data to be inserted: "))

Arr.append(data)

def DELETEQ(Arr):

if (Arr==[]):

print( "Queue empty")

else:

print ("Deleted element is: ",Arr[0])

del(Arr[0])



Discussion

No Comment Found

Related InterviewSolutions