Definition: A collection of elements that are stored next to each other in a line. Elements can only be inserted and deleted from the ends of the structure. Short for double ended queue.
Real Life Example:
Think of an NFL game. Before the ball is snapped, linemen from both teams are huddled right by the ball. Players on each end are standing behind the linemen and even more players are standing behind the second line. When the ball is snapped and everyone jumps towards each other, a deque is created. Players can join or leave the pile from the very outside but can't just show up in the middle.
Note: The first element in a deque (farthest left) is referred to as the "front". The last element in a deque (farthest right) is referred to as the "rear" or "back".
Basic Deque Operations:
Fun Fact: Deque is pronounced "deck" not "DQ".
Commonly Used In:
Other Similar Data Structures: