Deques
Deques, short for double-ended queues, are a data structure that allows insertion and removal from both the front and the back. Unlike a standard queue, which supports insertion at the back and removal from the front, and unlike a stack, which supports insertion and removal at one end, a deque provides operations at both ends. Elements are stored in a linear order, and the end from which an operation occurs may be referred to as the front or back.
Common operations include push_front, push_back (sometimes called insert at front/back), pop_front, pop_back, as well as methods
Deques can be implemented using a doubly linked list, which gives O(1) time for all ends with
Common applications include breadth-first search where both ends may be used, sliding window algorithms that extend