double-ended queues we next consider queue-like data structure that supports insertion and deletion at both the front and the back of the queue such structure is called doubleended queueor dequewhich is usually pronounced "deckto avoid confusion with the dequeue method of the regular queue adtwhich is pronounced like the abbreviation " the deque abstract data type is more general than both the stack and the queue adts the extra generality can be useful in some applications for examplewe described restaurant using queue to maintain waitlist occassionallythe first person might be removed from the queue only to find that table was not availabletypicallythe restaurant will re-insert the person at the first position in the queue it may also be that customer at the end of the queue may grow impatient and leave the restaurant (we will need an even more general data structure if we want to model customers leaving the queue from other positions the deque abstract data type to provide symmetrical abstractionthe deque adt is defined so that deque supports the following methodsd add first( )add element to the front of deque add last( )add element to the back of deque delete first)remove and return the first element from deque dan error occurs if the deque is empty delete last)remove and return the last element from deque dan error occurs if the deque is empty additionallythe deque adt will include the following accessorsd first)return (but do not removethe first element of deque dan error occurs if the deque is empty last)return (but do not removethe last element of deque dan error occurs if the deque is empty is empty)return true if deque does not contain any elements len( )return the number of elements in deque din pythonwe implement this with the special method len