← 返回 linkedin 的题目列表Reservoir Sampling in an Infinite Stream
类型:online_judge
How do you implement reservoir sampling in an infinite data stream? Write the specific code in Python.
Example
Input
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], k=3
Output
A random sample of 3 elements from the list