arXiv:2610.24273cs.DSOct 2026

Manuscript Offprint

arXiv:2610.24273

Batch range mode in O(n+Q)^1.395

Filippo di Gravina

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

We give a deterministic worst-case algorithm for exact Batched Range Mode on an arbitrary array of length n and a batch of Q intervals. The algorithm returns the mode frequency and the smallest mode identifier for each query in time

(n+Q)τ+o(1),τ=5−13=1.394448724536….(n+Q)^{\tau+o(1)},\qquad\tau=5-\sqrt{13}=1.394448724536\ldots.

The algorithm combines virtual occurrence windows and block-boundary snapping with a query-restricted min-plus product whose first operand is column-monotone and whose second operand is row-monotone. A deterministic modular verifier uses geometric and query potentials to bound the same active regions; false modular matches are corrected by offline orthogonal range updates. The final analysis uses the sharper rectangular exponent curve of Uznański (2026), together with exact rational parameter balancing and a transfer to prime fields. The analysis covers every frequency scale and arbitrary batch sizes. Exact frequencies and the smallest mode identifiers are recovered without increasing the exponent.

1 Introduction

In Batched Range Mode, the input is an array and a list of intervals, and each interval asks for its most frequent color. We consider the exact offline problem, with no restrictions on the palette, the arrangement of occurrences, or the query intervals.

Theorem 1.1. Given an explicit array of length n and an explicit batch of Q intervals, the mode frequency and the smallest identifier among the modes of each nonempty interval can be computed in deterministic worst-case time

(n+Q)τ+o(1),τ=5−13=1.394448724536….(n+Q)^{\tau+o(1)},\qquad\tau=5-\sqrt{13}=1.394448724536\ldots.

Empty intervals have frequency zero and no mode color. Repeated intervals are allowed. Construction of intermediate instances, input reads, and output writes are included in the bound.

Previous work. Vassilevska Williams and Xu [1] connected Batched Range Mode to structured min-plus multiplication. Gu, Polak, Vassilevska Williams, and Xu [2] developed this connection using monotone min-plus products. Chi, Duan, Xie, and Zhang [3] improved the randomized monotone primitive, and Dürr [4] extended it to rectangular dimensions; we use the corrected Batched Range Mode comparison in arXiv:2208.02862v4 rather than the erroneous numerical exponent in an earlier version. Jin, Park, Saha, and Xu [5] derandomized the monotone primitive and its downstream applications. Our product additionally uses monotonicity in both external coordinates and restricts correction to prescribed output cells. The matrix-multiplication analysis uses the rectangular exponent bound of Uznański [9], based on the square-multiplication work of OpenAI [10]. For Q=Θ(n)Q = \Theta(n), our bound is n5−13+o(1)n^{5-\sqrt{13}+o(1)}.

The product used here. Our first operand is monotone in its external coordinate, as is the second operand in the other external coordinate. Their min-plus product is therefore monotone in both output coordinates. We exploit this property while computing only a prescribed set E of output cells. A recursive product on E extends to a monotone candidate over the full grid using prefix maxima. This extension costs linear time in the grid size and does not require the true min-plus values elsewhere.

For the verifier, rounded blocks of the two operands define rectangles. Intersecting those rectangles with rounded candidate values gives regions that can be represented by three-dimensional boxes. The same active regions admit both a geometric bound and a bound charged to the requested cells. Combining these bounds across refinement levels is the source of the improved exponent. The modular selection follows the small-prime potential framework of Jin et al. [5]; we give the selection and correction arguments for the two potentials used here.

The Range Mode reduction uses virtual occurrence windows and a uniform grid of block boundaries. The colors in the two boundary fragments of a query are checked exactly. A witnessing color absent from those fragments has all its occurrences in the snapped interior. On that interior we use true prefix ranks, obtaining both operand monotonicities directly. This avoids a graph lifting or a completion of missing ranks.

Model and notation. We work on a word-RAM with O(log⁡N)O(\log N)-bit words, where N=max⁡(2,n+Q)N = \max(2, n + Q). Color identifiers have O(log⁡N)O(\log N) bits and are totally ordered. We write O~\tilde{O} for polylogarithmic factors and O^\widehat{O} for No(1)N^{o(1)} factors; all dimensions and integer magnitudes in intermediate instances are polynomially bounded in NN. The uniform meaning of Nτ+o(1)N^{\tau + o(1)} is that for every ε>0\varepsilon > 0 there is an algorithm of cost Oε(Nτ+ε)O_{\varepsilon}(N^{\tau + \varepsilon}). We use exact ordinary matrix multiplication, fast polynomial evaluation and interpolation, and the prime-number theorem. The matrix-multiplication bounds and their finite-field implementation are justified in section 4 using the explicitly cited external matrix-multiplication results. The finite-field and word-RAM implementation is proved there. Earlier rectangular bounds appear in [6, 7]. The proof uses the cited rectangular matrix-multiplication bound as an external theorem and proves the transformations and asymptotic consequences required for the present algorithms. Rounding dimensions and cutoffs changes only constant or subpolynomial factors.