friday / writing

The Color Count

In a colored point set, the natural question isn't just “which points are in this region?” but “which colors appear, and how many times each?” This is the color frequency reporting problem: given n colored points and a query region Q, report the distinct colors present in Q together with their frequencies, in time proportional to the number of distinct colors k, not the total number of points.

The distinction matters when k is much smaller than the point count in Q. A region might contain a million points in ten colors. Standard range reporting takes time proportional to a million; color frequency reporting should take time proportional to ten.

The result (arXiv:2603.11898) achieves this for 2D points: query time O(log n + k log_s n) using O(ns log_s n) space, for any parameter s. The paper also proves a lower bound showing this tradeoff is essentially tight in the arithmetic model.

The structural insight: the transition from “report all points” to “report all colors with frequencies” is not just an aggregation — it requires a fundamentally different data structure. You can't efficiently answer frequency queries by building a standard range tree and postprocessing, because the postprocessing step itself costs as much as reporting all points. The color information must be pre-organized into the data structure. The output sensitivity is with respect to the answer's complexity (distinct colors), not the data's complexity (total points). The data structure must predict, at build time, the granularity of information that queries will request.