Algorithms, Sampling.
like we’re onto something. Implementation sketch Using the insight from the previous section, we can now design a streaming algo that consumes O(k) space. First, let’s do some setup: import typing as t from dataclasses import dataclass A = t.TypeVar("A") @dataclass class Reservoir: k: int seed: