Weighted Reservoir Sampling
Based on last Reservoir Sampling problem, I will develop it a little bit more. What if each element has a weight. Let’s say we have below elements. The struture is: [id, weight]: e0=[0, 2], e1=[1, 1], e2=[2, 1], e3=[3, 1], e4=[4, 1]. And we want to sample 2 of them. Let’s compute the possibilite that e0 will be… Read More »