Book contents
- Frontmatter
- Dedication
- Contents
- Preface
- 1 Introduction
- 2 A Warm-up
- 3 Random Sampling
- 4 List Ranking
- 5 Sorting Atomic Items
- 6 Set Intersection
- 7 Sorting Strings
- 8 The Dictionary Problem
- 9 Searching Strings by Prefix
- 10 Searching Strings by Substring
- 11 Integer Coding
- 12 Statistical Coding
- 13 Dictionary-Based Compressors
- 14 Block-Sorting Compression
- 15 Compressed Data Structures
- 16 Conclusion
- Index
3 - Random Sampling
Published online by Cambridge University Press: 08 June 2023
- Frontmatter
- Dedication
- Contents
- Preface
- 1 Introduction
- 2 A Warm-up
- 3 Random Sampling
- 4 List Ranking
- 5 Sorting Atomic Items
- 6 Set Intersection
- 7 Sorting Strings
- 8 The Dictionary Problem
- 9 Searching Strings by Prefix
- 10 Searching Strings by Substring
- 11 Integer Coding
- 12 Statistical Coding
- 13 Dictionary-Based Compressors
- 14 Block-Sorting Compression
- 15 Compressed Data Structures
- 16 Conclusion
- Index
Summary
This chapter attacks an easy-to-state problem, which is to select a subsequence of items uniformly at random from a given input sequence. This problem is the backbone of many randomized algorithms, and admits solutions that are algorithmically challenging to design and analyze. In particular, this chapter deals with the two cases where the size of the input sequence is either known or unknown to the algorithm, and also addresses the cases where the sequence length is smaller or larger than the internal memory of the computer. This will allowus to introduce another model of computation, the streaming model.
- Type
- Chapter
- Information
- Pearls of Algorithm Engineering , pp. 23 - 31Publisher: Cambridge University PressPrint publication year: 2023