Skip to content
DeepForgeby svx
All problems
MediumProbabilitypr-264

Balls-in-Bins Max Load Estimate

Problem

For n balls thrown independently and uniformly into n bins, the classic Poisson approximation for the expected maximum bin load is ln(n) / ln(ln(n)) for n >= 3. Return 1.0 for 1 <= n < 3 and 0.0 for n <= 0.

Hint

The maximum load grows like log n over log log n, far slower than the average load.

Test cases

case 1
in: [10]
expected: 2.7607859935346912
case 2
in: [100]
expected: 3.0154738238809906
case 3
in: [1000]
expected: 3.574249916581999
case 4
in: [2]
expected: 1
case 5
in: [0]
expected: 0
Starter codePython
import math


def max_load_estimate(bins):
    # Your code here
    pass

5 test cases · run your code against them in the editor