Abstract
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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
Bayer, D., Diaconis, P.: Trailing the dovetail shuffle to its lair. The Annals of Applied Probability 2(2), 294–313 (1992)
Cover, T.M., Thomas, J.A.: Elements of information theory, 2nd edn. Wiley (2006)
Knuth, D.E.: The Art of Computer Programming. Seminumerical Algorithms, 2nd edn., vol. II. Addison-Wesley (1981)
Knuth, D.E.: The art of computer programming. Sorting and Searching, 2nd edn., vol. 3. Addison Wesley Longman Publishing Co., Inc., Redwood City (1998)
Matias, Y., Vitter, J.S., Ni, W.-C.: Dynamic generation of discrete random variates. Theory Comput. Syst. 36(4), 329–358 (2003)
Newman, M.E.J.: Power laws, pareto distributions and zipf’s law. Contemporary Physics 46, 323–351 (2005)
Walker, A.J.: An efficient method for generating discrete random variables with general distributions. ACM Transactions on Mathematical Software 3(3), 253–256 (1977)
Wong, C.K., Easton, M.C.: An efficient method for weighted sampling without replacement. SIAM J. Comput. 9(1), 111–113 (1980)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2012 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Lang, K.J. (2012). Practical Algorithms for Generating a Random Ordering of the Elements of a Weighted Set. In: Kranakis, E., Krizanc, D., Luccio, F. (eds) Fun with Algorithms. FUN 2012. Lecture Notes in Computer Science, vol 7288. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-30347-0_27
Download citation
DOI: https://doi.org/10.1007/978-3-642-30347-0_27
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-642-30346-3
Online ISBN: 978-3-642-30347-0
eBook Packages: Computer ScienceComputer Science (R0)