Practical Algorithms for Generating a Random Ordering of the Elements of a Weighted Set

This paper discusses the problem of efficiently generating a random ordering of the elements of an n-element weighted set, where the elements' weights are interpreted as relative probabilities. The paper reviews the current status of this problem, which includes a purely theoretical algorithm with the optimal O(n) cost, then presents several new algorithms that are simple, practical and nearly optimal, including one with an expected cost of O(n loglogn) on worst-case inputs, and another one with an expected cost of O(n) when the weights are randomly chosen from distributions that are believed to be ubiquitous in the real world. It is still an open question whether there exists a practical algorithm with O(n) expected cost on worst case inputs.

[1]  Peter Nijkamp,et al.  Accessibility of Cities in the Digital Economy , 2004, cond-mat/0412004.

[2]  Ronald L. Rivest,et al.  Introduction to Algorithms , 1990 .

[3]  Chak-Kuen Wong,et al.  An Efficient Method for Weighted Sampling Without Replacement , 1980, SIAM J. Comput..

[4]  Kurt Mehlhorn,et al.  Maintaining Discrete Probability Distributions Optimally , 1993, ICALP.

[5]  Sanguthevar Rajasekaran,et al.  Fast algorithms for generating discrete random variates with changing distributions , 1993, TOMC.

[6]  Vahid Tarokh,et al.  Existence of optimal prefix codes for infinite source alphabets , 1997, IEEE Trans. Inf. Theory.

[7]  P. Diaconis,et al.  Trailing the Dovetail Shuffle to its Lair , 1992 .

[8]  Philippe Flajolet,et al.  The Complexity of Generating an Exponentially Distributed Variate , 1986, J. Algorithms.

[9]  Paul Bratley,et al.  A guide to simulation (2nd ed.) , 1986 .

[10]  Paul B. Callahan,et al.  Output-sensitive generation of random events , 1998, SODA '98.

[11]  Thomas M. Cover,et al.  Elements of Information Theory: Cover/Elements of Information Theory, Second Edition , 2005 .

[12]  Donald E. Knuth,et al.  The art of computer programming, volume 3: (2nd ed.) sorting and searching , 1998 .

[13]  Jan van Leeuwen,et al.  On the Construction of Huffman Trees , 1976, ICALP.

[14]  Alastair J. Walker,et al.  An Efficient Method for Generating Discrete Random Variables with General Distributions , 1977, TOMS.

[15]  Donald E. Knuth,et al.  The Art of Computer Programming: Volume 3: Sorting and Searching , 1998 .

[16]  L. Devroye Non-Uniform Random Variate Generation , 1986 .

[17]  Donald E. Knuth,et al.  The art of computer programming. Vol.2: Seminumerical algorithms , 1981 .

[18]  Jeffrey Scott Vitter,et al.  Dynamic Generation of Discrete Random Variates , 1993, SODA '93.

[19]  M. E. J. Newman,et al.  Power laws, Pareto distributions and Zipf's law , 2005 .

[20]  Bennett L. Fox,et al.  Generating Markov-Chain Transitions Quickly: I , 1990, INFORMS J. Comput..