listing the arrayqueue py module implementation of the queue adt using circular array from array import array class queue creates an empty queue def __init__selfmaxsize self _count self _front self _back maxsize self _qarray arraymaxsize returns true if the queue is empty def isemptyself return self _count = returns true if the queue is full def isfullself return self _count =len(self _qarrayreturns the number of items in the queue def __len__self return self _count adds the given item to the queue def enqueueselfitem )assert not self isfull()"cannot enqueue to full queue maxsize len(self _qarrayself _back (self _back maxsize self _qarray[self _backitem self _count + removes and returns the first item in the queue def dequeueself )assert not self isempty()"cannot dequeue from an empty queue item self _qarrayself _front maxsize len(self _qarrayself _front (self _front maxsize self _count - return item will wrap around to element and the new value will be stored in that position figure illustrates the circular array when first created by the constructor the size(and isempty(methods use the value of count to return the appropriate result as indicated earlierimplementing the queue adt as circular array creates the special case of queue with maximum capacitywhich can result in full queue for this implementation of the queuewe must add the isfull(methodwhich can be used to test if the queue is full againthe count field is used to determine when the queue becomes full to enqueue an itemas shown in lines - we must first test the precondition and verify the queue is not full if the condition is metthe new item can be inserted