AI engineering glossary · Data structures algorithms
What is deque?
Deque (also called double-ended queue): A double-ended queue that supports adding and removing items efficiently at both the front and the back. It generalises both a stack and a queue and is handy for sliding-window problems.
Deque: an example
Python's collections.deque lets you call append and popleft in constant time, unlike a list where removing from the front shifts every item.
Related terms
More Data structures algorithms terms
- Dijkstra's algorithm
- Directed acyclic graph
- Divide and conquer
- Doubly linked list
- Dynamic array
- Dynamic programming
- Edit distance
- Fenwick tree
Where you learn it
Deque is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.