Exemple #1
0
from myqueue import Queue

myq = Queue()

myq.Enqueue('A')
myq.Enqueue('B')
myq.Enqueue('C')
myq.Enqueue('D')
myq.Enqueue('A')
myq.Enqueue('E')

myq.PrintQueue()

len_now = myq.queueNo


def deleteqA(item):

    i = 0
    while i < len_now:

        if myq.queue[myq.front + 1] != item:
            myq.Enqueue(myq.Dequeue())

        else:
            myq.Dequeue()

        i += 1


def deleteqA2(item):
from myqueue import Queue

myq = Queue()

myq.Enqueue('A')
myq.Enqueue('B')
myq.Enqueue('C')
myq.Enqueue('D')
myq.Enqueue('E')

myq.PrintQueue()
print("Elements in queue: ", myq.queueNo)  # Please check queue.py for details

myq.Dequeue()
myq.PrintQueue()
print("Elements in queue: ", myq.queueNo)  # Please check queue.py for details

myq.Enqueue('F')
myq.PrintQueue()
print("Elements in queue: ", myq.queueNo)  # Please check queue.py for details