Searcharxiv⌕ Search

arXiv · 2611.26848

Revisiting Generalized Median Estimators: Exact Bitwise Computation and Gray Code Acceleration

Abstract

Generalized median estimators evaluate the median of a symmetric kernel over all $M = \binom{n}{k}$ subsets of size $k$. Exhaustive evaluation was considered impractical even for $n = 29, k = 5$ ($M = 118,755$), prompting stochastic subsampling (Wilde and Grimshaw, 2013). We show that this barrier is computational, not combinatorial: storing all subsets requires $Θ(kM)$ space, whereas stateful enumeration uses $\mathcal{O}(k)$ auxiliary state and retains only $M$ kernel values. We combine two exhaustive traversals with three-way Quickselect and a deterministic median-of-medians fallback, giving worst-case $\mathcal{O}(M)$ selection. Gosper's successor takes $\mathcal{O}(k)$ kernel work per subset for $n < w$; a Revolving Door Gray code changes one element out and one in, enabling $\mathcal{O}(1)$ kernel updates between recalibrations and $\mathcal{O}(M + kM/P)$ total time. We derive floating-point error bounds for the location ($h_1$) and mean-centered sample variance ($h_2$) kernels and their resulting median. For $n = 29, k = 5$, our ANSI C implementation evaluates all $118,755$ subsets in $0.74$ ms and $0.71$ ms, respectively. A direct C sweep places the crossover with partial lexicographic unranking at approximately $18,000$-$23,000$ subsets ($15\%$-$19\%$ of $M$), below the $32,160$-$45,420$ subsets required by Wilde and Grimshaw's sequential approximation at $ε= 0.01$.

Explore related subjects

Keep this discovery

Explore connections, maps & timelines

BibTeXRIS

Robin Nunkesser. 2026-11-19. Revisiting Generalized Median Estimators: Exact Bitwise Computation and Gray Code Acceleration. https://searcharxiv.com/abs/2611.26848

Citations retain the original authors and DOI and include this site’s record URL. If this discovery service contributed to your research, you can also cite Searcharxiv by Indiciae: BibTeX · RIS.

KEEP EXPLORING

Related papers

Space-Efficient Interior Point Method, with applications to Linear Programming and Maximum Weight Bipartite Matching

We study the problem of solving linear programs in the streaming model. Given a constraint matrix $A\in\mathbb{R}^{m\times n}$ and vectors $b\in\mathbb{R}^m, c\in\mathbb{R}^n$, we develop a space-efficient interior point method that optimizes solely on the dual program. To this end, we obtain efficient algorithms for various different problems. For general linear programs whose feasible region lies in a ball of radius $R$ and contains a ball of radius $r$ with known center, we can solve them in $\widetilde{O}(\sqrt{n}\log(mR^2\|c\|_2/(rε)))$ passes and $\widetilde{O}(n^2)$ space for an $ε$-approximate solution. To the best of our knowledge, this is the most efficient LP solver in streaming with no polynomial dependence on $m$ for both space and passes. For bipartite graphs, we can solve the minimum vertex cover and maximum weight matching problems (with polynomially bounded integer weights) in $\widetilde{O}(\sqrt{m})$ passes and $\widetilde{O}(n)$ space. In addition to our space-efficient IPM, we also give algorithms for solving SDD systems and the isolation lemma in $\widetilde{O}(n)$ space, which are the cornerstones for our graph results.

cs.DS↗

Faster algorithms for packing forests in graphs and related problems

We consider several problems related to packing forests in graphs. The first one is to find $k$ edge-disjoint forests of maximum size in a directed graph $G$ such that the indegree of each vertex in these forests is at most $k$. We describe a min-max characterization for this problem and show that it can be solved in almost linear time for fixed $k$, extending the algorithm of [Gabow, 1995]. Specifically, the complexity is $O(k δm \log n)$, where $n, m$ are the numbers of vertices and edges in $G$, respectively, and $δ= \max\{1, k - k_G\}$, where $k_G$ is the edge connectivity of the graph. Using our solution to this problem, we obtain algorithms for two applications: (1) The $k$-forest problem: find $k$ forests in an undirected graph $G$ maximizing the number of edges in their union. We show how to solve this problem in $O(k^3 \min\{kn, m\} \log^2 n + k \cdot{\rm MAXFLOW}(m, m) \log n)$ time, breaking the $O_k(n^{3/2})$ complexity barrier of previously known approaches. (2) The Directed edge-connectivity augmentation problem: find a smallest set of directed edges whose addition to the given directed graph makes it strongly $k$-connected. We give a deterministic algorithm with complexity $O(k δm \log n)+T_{\rm split}$, where $T_{\rm split}$ is the time to split off one vertex in a graph with $O(m+δn)$ edges while preserving strong connectivity among the original vertices. For Eulerian directed graphs, the total complexity is $O(k δm \log n)$. A similar approach solves the undirected version of the problem in $O(k δm \log n)$ time.

cs.DS↗

LZD-style Compression Scheme with Truncation and Repetitions

Lempel-Ziv-Double (LZD) is a variation of the LZ78 compression scheme that achieves better compression on repetitive datasets. Nevertheless, prior research has identified computational inefficiencies and a weakness in its compressibility for certain datasets. In this paper, we introduce LZD+, an enhancement of LZD, which enables expected linear-time online compression by allowing truncated references. To address the compressibility weakness exhibited by a lower bound example, we propose LZDR}(LZD-runlength compressed), a further enhancement on top of LZD+, which introduces a repetition-based factorization rule while maintaining linear expected time complexity for offline compression. Both time bounds can be de-randomized by a lookup data structure like a balanced search tree with a logarithmic dependency on the alphabet size. We prove that LZD+ and LZDR, like LZD, have an approximation ratio of $Ω(n^{1/3})$ with respect to the smallest grammar, already on a single family of binary strings. Conversely, all three produce $O(n^{2/3}δ^{1/3})$ factors, where $δ$ is the substring complexity of the text. Additionally, we present three flexible parsing variants of LZDR that yield fewer factors in practice; for one of them, we prove that it never yields more factors than greedy LZDR. Comprehensive benchmarking on standard corpora reveals that LZD+, LZDR, and its flexible variants outperform existing LZ-based methods in the number of factors while keeping competitive runtime efficiency. However, we note that the difference in the number of factors becomes marginal for large datasets like those of the Pizza&Chili corpus.

cs.DS↗