Data Structures & AlgorithmsVery hardICPC regional · probability

Problem: What is the expected number of distinct values when n balls are thrown uniformly into n bins?

  1. A. Exactly n
  2. B. About log n
  3. C. About n(1 - 1/e)
  4. D. About n^2

Correct answer: C. About n(1 - 1/e)

The expected number of empty bins is about n/e, so the distinct occupied bins are about n(1 - 1/e).

More Coding Interview Problems questions

Exams that ask this topic