A Deque is a linear list in which elements can be added or removed at either end but not in the middle. One can insert an element at an end of the queue. It is an indexed sequence container that allows fast insertion and deletion at both its beginning and its end. It also is known as a double-ended queue, is an ordered collection of items similar to the queue.
There are two types of Deque in a data structure. They are:
Input Restricted Deque: Input Restricted Deque is a queue which allows insertion at only one end of the list but allows deletion at both ends of the list.
Output Restricted Deque: Output Restricted Deque is a queue that allows deletion at one end of the list but allows insertion at both ends of the list.
It is important to note that even though the deque can assume many of the characteristics of stacks and queues, it does not require the LIFO and FIFO orderings that are enforced by those data structures.