First-Order Entropic Sampling of Words with Prescribed Letter Counts in Linear Time
Abstract
We sample, exactly and uniformly, a word of length n over the alphabet {0, . . . , r} in which the letter j occurs a prescribed positive number k j of times, from a source of fair random bits. Every exact sampler reads on average at least H = log 2 (___ n k0,...,kr )___ bits. We give a sampler that reads on average at most H fresh bits, whatever r and the counts, and that performs O(n) bit operations on average over every fixed alphabet, in a bit-RAM in which a memory access costs O(1) while arithmetic is charged bit by bit. Both bounds are optimal: the first one to first order, the second one up to a constant factor, since writing the output already costs (n). The sampler writes the word as a Huffman tree of independent binary words, and samples each of them in one of two ways. Binary words with few ones are generated by random insertions; the rank of each inserted letter among its copies, which the Fisher-Yates shuffle generates for nothing, is uniform and independent of the word, and is given back to a recycling source of uniform integers, where it pays for the next insertions. Binary words with many ones are generated by MergeShuffle driven by blocks of (log n) bits of entropy; a block is decoded by locating only its ones when the minority letter is rare, and otherwise, its number of ones being concentrated, by a precomputed table of the blocks of typical type, of size O( \sqrt n log 4 n), the rare atypical blocks being decoded slowly.
Create a lesson
Related papers
A Deterministic Linear Time Algorithm for Minimum Spanning Tree
Shared title terminologycs.DSSanjeev Khanna, Aaron Putterman, Junkai Song
Counting 6-Cliques in O(n^{5.97}) time and O(\log n) space
Shared title terminologycs.DSAfrouz Jabal Ameli, Niklas Mohrin, Jesper Nederlof
LinearKnot: Linear-Time Approximation of the Pseudoknot Partition Function
Shared title terminologycs.DSMilan Gautam, David H. Mathews, Liang Huang
An Order-Optimal Square-Root Bound for Online Maximin Share Allocation with Known Types
Shared title terminologycs.DSZheyu Zhou
A Constant-Factor Single-Sample Prophet Inequality for Subadditive Valuations
Shared title terminologycs.DSShuchi Chawla, Trung Dang
Weighted Flow Time Does Not Admit Constant-Competitive Randomized Algorithms
Shared title terminologycs.DSAlexander Lindermayr