Randomly select an element from a list

32 Views Asked by At

Suppose I have a list that contains N elements, every time I randomly select an element from it and mark it as visited. What is the expected number of selection that I have to make until all the elements in the list are marked as visited?

1

There are 1 best solutions below

0
On BEST ANSWER

With $N$ elements, the expected number of selections you have to make is

$$N \displaystyle\sum_{k=1}^N \frac{1}{k}$$

As was noted in the comments, this is called the coupon collector's problem.