Deque
A deque is a double-ended queue data structure that supports insertion and removal at both its front and back.
Fabulous Adventures in Data Structures and Algorithms
A mutable double-ended queue is a double-ended queue whose contents can be changed by operations at either end.
- How it is used
- Supports access at both ends while motivating an efficient immutable, persistent sequence.
- How deep it goes
- Develops the C# interface, a failed naïve representation, recursive chunked operations, complexity, generic types, and concatenation.
- Examples
- Uses a character deque to trace edge overflows and an undo–redo queue to contrast mutable use.
- What you can do after
- Build it from scratch as a persistent C# deque with cheap end operations and recursive concatenation.
Read how Fabulous Adventures in Data Structures and Algorithms explains deque →
Refactoring to Rust
A double-ended queue is a sequence data structure that supports insertion and removal at both its front and back.
- How it is used
- Implements a stack for evaluating reverse Polish notation expressions.
- How deep it goes
- Defines front and back operations, contrasts VecDeque with Vec, and demonstrates a stack wrapper without exploring internal storage mechanics.
- Examples
- Demonstrates RpnStack with arithmetic expressions including `3 4 +`, multiplication, division, and empty-stack failure.
- What you can do after
- Build it from scratch as a Rust wrapper that pushes and pops values at one deque end.
Python Concurrency with asyncio
A deque is a double-ended queue that supports insertion and removal at both ends.
- How it is used
- Uses bounded deques to manage terminal messages, scrolling output while preserving the input field.
- How deep it goes
- Explains bounded storage, append behavior, input buffering, and redraw callbacks, but does not discuss implementation internals.
- Examples
- Uses a scrolling message display, a character input buffer, a MessageStore, and an asynchronous delay console.
- What you can do after
- Apply it via Python's collections.deque to build bounded message stores and scrolling console output.
Also covered in
- Learn Rust in a Month of Lunches
- Algorithms Every Programmer Should KnowIn early access (MEAP)
- Python How-To
What to know first
- optionAn option type is a type that represents either a value of a specified type or its absence as distinct alternatives.
- priority queueA priority queue is an abstract data type that retrieves or removes elements according to assigned priority rather than insertion order.
- result typeA result type represents the outcome of an operation as either a successful value or a failure, often carrying information about either outcome.
- stackA stack is a last-in, first-out data structure in which elements are added and removed at the same end.
Related concepts
- deque of minishas part · A deque of minis is the recursive middle component of this deque representation whose elements are bounded mini-deques.
- queueused by · A queue is an ordered collection that holds items for retrieval or processing, commonly in first-in, first-out order.
- ring bufferuses · A ring buffer is a fixed-capacity storage structure whose positions are reused cyclically as elements are added and removed.
- sequencekind of · A sequence is an ordered collection of elements whose positions determine the order in which they are arranged or traversed.
- amortized analysismeasured by · Amortized analysis bounds the total cost of a sequence of operations by distributing occasional expensive operations across the sequence.
- concatenationused by · Concatenation is the operation of joining ordered sequences end to end, or along a specified dimension, to form a combined sequence or structure.
Questions about deque
What is deque?
A deque is a double-ended queue data structure that supports insertion and removal at both its front and back.
Which Manning books explain deque?
Fabulous Adventures in Data Structures and Algorithms, Refactoring to Rust and Python Concurrency with asyncio.
What should I know before learning deque?
Manning books that teach deque usually introduce option, priority queue, result type and stack first.
What is deque a kind of?
Deque is a kind of sequence. A sequence is an ordered collection of elements whose positions determine the order in which they are arranged or traversed.
What are the parts of deque?
Deque includes deque of minis.
What is deque also called?
Deque is also called double-ended queue.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.


