Q. 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])


Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post