Questions: Random Sampling Techniques

4 questions to test your understanding

Score: 0 / 4
Question 1 Multiple Choice

Reservoir sampling maintains a sample of size k from a stream. When the i-th element arrives (i > k), it replaces a random element in the reservoir with probability k/i. After n elements, each element is in the reservoir with probability exactly k/n. What makes this non-obvious?

AThe algorithm requires knowing n in advance to set the replacement probability
BThe probability that an element stays involves a telescoping product: it must survive all subsequent replacement attempts, and this product must equal k/n despite the algorithm never knowing n
CThe algorithm requires O(n) random bits to achieve uniform sampling
DEach element's inclusion probability depends on the other elements in the stream
Question 2 True / False

In importance sampling, you draw samples from a proposal distribution q(x) instead of the target distribution p(x), and reweight by p(x)/q(x). This reweighting always produces an unbiased estimator of E_p[f(x)].

TTrue
FFalse
Question 3 Short Answer

Explain why random sampling enables sublinear-time algorithms and what fundamental tradeoff is involved.

Think about your answer, then reveal below.
Question 4 True / False

Reservoir sampling requires knowing the total stream length n in advance to set correct replacement probabilities.

TTrue
FFalse