Written by the Fiveable Content Team โข Last updated September 2025
Verified for the 2026 exam
Verified for the 2026 examโขWritten by the Fiveable Content Team โข Last updated September 2025
Definition
Deques, short for double-ended queues, are data structures that allow insertion and removal of elements from both ends. They can be used to implement stacks and queues efficiently.
Related terms
Stacks: A stack is a data structure that follows the Last-In-First-Out (LIFO) principle, where elements are added and removed from only one end.
Queues: A queue is a data structure that follows the First-In-First-Out (FIFO) principle, where elements are added at one end and removed from the other end.
Arrays are fixed-size collections of elements stored in contiguous memory locations. They provide fast access to individual elements but have limited flexibility for insertion and deletion operations.