Suggest an editImprove this articleRefine the answer for “What operations does a deque support?”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)A **deque (double-ended queue)** supports the main operations addFront, addRear, removeFront, removeRear, peekFront, peekRear, isEmpty, and size, all in O(1). **Key point:** thanks to access from both sides, a deque can be used both as a queue (FIFO) and as a stack (LIFO).Shown above the full answer for quick recall.Answer (EN)ImageA **deque (double-ended queue)** supports the following main operations, all in **O(1)**: 1. **addFront(x)**: add element `x` to the front. 2. **addRear(x)**: add element `x` to the back. 3. **removeFront()**: remove and return the element from the front. 4. **removeRear()**: remove and return the element from the back. 5. **peekFront()**: look at the first element without removing it. 6. **peekRear()**: look at the last element without removing it. 7. **isEmpty()**: check whether the queue is empty. 8. **size()**: return the number of elements (sometimes added). Thanks to access from both sides, a deque can be used both as a **queue (FIFO)** and as a **stack (LIFO)**.For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.