Monotonic Queue (Monotonic Deque)

Sliding Window Maximum / Minimum — Step-by-Step Visualization

Input

Array (window highlighted)

Green = inside current window  | Orange = current i  | Blue bracket = window [l..r]

Monotonic Deque (front -> back, stores indices)

empty
Push (green)  | Pop back (red, smaller than incoming)  | Pop front (purple, expired)

Step Info

Press Step to advance one operation, or Play to auto-run.

Controls

Statistics

-
Current i
0
Deque Size
0
Pushes
0
Back Pops
0
Front Pops
0
Recorded

Current Answer Sequence

[]

Big-O Complexity

AspectValue
Total timeO(n)
Per element (amortized)O(1)
Per element (worst single)O(k)
SpaceO(k)
Brute forceO(n*k)

Operation Log