Guided lesson

Deque

Linear Data Structures

Deque

Core

Mental model

  • Can behave as a stack or queue.

Operations

pushFront O(1)

Cost shape

Core operations O(1)

Watch out

Implementing with an array API that makes front operations O(n).

Related algorithms

Sliding Window MaximumBFS
Guided progression
10% lesson
Step 1 / 2Learner goal
Speech settings Speed 1.0 · Volume 90%

Keyboard: Space play/pause · Arrow keys step · Page Up/Down change sections · R restart