Question: Suppose that we modify the reservoir sampling algorithm so that, when the k th item appears, it replaces the item in memory with probability 1/2.
Suppose that we modify the reservoir sampling algorithm so that, when the k th item appears, it replaces the item in memory with probability 1/2. Describe the distribution of the item in memory.
Thank you so much!
(Here is the question about reservoir sampling:
The following approach is often called reservoir sampling. Suppose we have a sequence of items passing by one at a time. We want to maintain a sample of one item with the property that it is uniformly distributed over all the items that we have seen at each step. Moreover, we want to accomplish this without knowing the total number of items in advance or storing all of the items that we see.Consider the following algorithm, which stores just one item in memory at all times. When the first item appears, it is stored in the memory. When the kth item appears, it replaces the item in memory with probability 1/k. )
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
