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.
KeywordsRandom Permutation Expected Cost Practical Algorithm Balance Tree Discrete Probability Distribution
Unable to display preview. Download preview PDF.
- 2.Cover, T.M., Thomas, J.A.: Elements of information theory, 2nd edn. Wiley (2006)Google Scholar
- 3.Knuth, D.E.: The Art of Computer Programming. Seminumerical Algorithms, 2nd edn., vol. II. Addison-Wesley (1981)Google Scholar
- 4.Knuth, D.E.: The art of computer programming. Sorting and Searching, 2nd edn., vol. 3. Addison Wesley Longman Publishing Co., Inc., Redwood City (1998)Google Scholar