Streams & I/O mind map
Merge streams, iterators, and sequential data.
Core idea: Data arrives once; keep only the summary or frontier future items require.
Mnemonic: Consume → retain minimum state → resume · Cost: One pass · bounded memory
Summarize: Running state
Signal: The stream cannot be replayed, but only an aggregate is needed.
Move: Update counters, checksum, or numerically stable statistics as each item arrives.
Examples: Moving Average, Running Variance, Stream Checksum
Prioritize: Live candidates
Signal: The stream repeatedly asks for top-k, median, or smallest next source.
Move: Retain only heap frontiers or balanced halves instead of all historical values.
Examples: Online Kth Largest, Median Stream, Merge K Streams
Buffer: Resumable iterator
Signal: Reads are partial and the next call must continue exactly where this one stopped.
Move: Preserve leftovers plus cursor state behind a small iterator or reader contract.
Examples: Read N With Read4, Peeking Iterator, RLE Iterator
Govern: Time & version state
Signal: Events must be limited, replayed, or queried as of a timestamp.
Move: Key state by identity and time; evict expired history and make retry semantics explicit.
Examples: Rate Limiter, Snapshot Array, Time Map