arXivPreprintOpen accesscs.DS

First-Order Entropic Sampling of Words with Prescribed Letter Counts in Linear Time

Olivier Bodini (LAGA), Francis Durand (LAGA)

Key points

From the paper's conclusion
  • 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.

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 $\Theta$(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 $\Theta$(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.

Read the paper

Discussion

Science Skim's AI key points, plus readers' public thoughts

Readers' thoughts

No reader thoughts yet.

Related papers