array-based queue implementation for the stack adtwe created very simple adapter class that used python list as the underlying storage it may be very tempting to use similar approach for supporting the queue adt we could enqueue element by calling append(eto add it to the end of the list we could use the syntax pop( )as opposed to pop)to intentionally remove the first element from the list when dequeuing as easy as this would be to implementit is tragically inefficient as we discussed in section when pop is called on list with non-default indexa loop is executed to shift all elements beyond the specified index to the leftso as to fill the hole in the sequence caused by the pop thereforea call to pop( always causes the worst-case behavior of th(ntime we can improve on the above strategy by avoiding the call to pop( entirely we can replace the dequeued entry in the array with reference to noneand maintain an explicit variable to store the index of the element that is currently at the front of the queue such an algorithm for dequeue would run in ( time after several dequeue operationsthis approach might lead to the configuration portrayed in figure figure allowing the front of the queue to drift away from index unfortunatelythere remains drawback to the revised approach in the case of stackthe length of the list was precisely equal to the size of the stack (even if the underlying array for the list was slightly largerwith the queue design that we are consideringthe situation is worse we can build queue that has relatively few elementsyet which are stored in an arbitrarily large list this occursfor exampleif we repeatedly enqueue new element and then dequeue another (allowing the front to drift rightwardover timethe size of the underlying list would grow to (mwhere is the total number of enqueue operations since the creation of the queuerather than the current number of elements in the queue this design would have detrimental consequences in applications in which queues have relatively modest sizebut which are used for long periods of time for examplethe wait-list for restaurant might never have more than entries at one timebut over the course of day (or week)the overall number of entries would be significantly larger