ARCHOS 525 BLUEPRINT · /d/dgm_code-sliding-window-maximum
Sliding-Window Maximum with a Monotonic Deque
6 COMPONENTS · 6 FLOWS · UPDATED 2026-11-24
GITHUB README / PR PREVIEW CARD
[](https://archos.sageideas.dev/d/dgm_code-sliding-window-maximum) *Interactive architecture diagram powered by [ArchOS Studio](https://archos.sageideas.dev/d/dgm_code-sliding-window-maximum)*
NOTION / DOCS / CONFLUENCE EMBED
<iframe src="https://archos.sageideas.dev/embed/dgm_code-sliding-window-maximum" width="100%" height="580" style="border:1px solid rgba(240,236,225,0.14);border-radius:6px;" loading="lazy" title="Sliding-Window Maximum with a Monotonic Deque — Interactive in ArchOS"></iframe>
PORTABLE MERMAID SPEC (GITHUB / NOTION / RFC)
flowchart LR
client_0["Stream of Values"]
n1_1["Window Expire Check"]
n2a_2[("Monotonic Deque")]
n2b_3["Push Current Index"]
n3_4["Rolling Window Max"]
downstream_5["Downstream & OTel"]
client_0 -->|"1. Evict old · O1"| n1_1
n1_1 -->|"2a. Pop = cur · Deque"| n2a_2
n1_1 -->|"2b. Push back · Amort O1"| n2b_3
n2a_2 -->|"3a. Peek front · O1"| n3_4
n2b_3 -->|"3b. Merge · RAM"| n3_4
n3_4 -.->|"4. Emit / · OTLP/API"| downstream_5COMPONENT STACK (6)
- Stream of ValuesSTATELESSLatency / Price Tick Series
- Window Expire CheckSTATELESSPop front if idx <= i - K
- Monotonic DequeSTATEFULMaintains strictly decreasing idx
- Push Current IndexSTATELESSEach element pushed/popped <= 1x
- Rolling Window MaxSTATELESSFront of deque is instant max
- Downstream & OTelSTATELESSConsumers, metrics & SLOs
REQUEST & DATA FLOW (6)
- Stream of Values → Window Expire Check (Evict old)[O1]
- Window Expire Check → Monotonic Deque (Pop <= cur)[Deque]
- Window Expire Check → Push Current Index (Push back)[Amort O1]
- Monotonic Deque → Rolling Window Max (Peek front)[O1]
- Push Current Index → Rolling Window Max (Merge)[RAM]
- Rolling Window Max → Downstream & OTel (Emit /)[OTLP/API]