English

An asymptotically optimal algorithm for generating bin cardinalities

Data Structures and Algorithms 2024-09-10 v2 Discrete Mathematics

Abstract

In the balls-into-bins setting, nn balls are thrown uniformly at random into nn bins. The na\"{i}ve way to generate the final load vector takes Θ(n)\Theta(n) time. However, it is well-known that this load vector has with high probability bin cardinalities of size Θ(lognloglogn)\Theta(\frac{\log n}{\log \log n}). Here, we present an algorithm in the RAM model that generates the bin cardinalities of the final load vector in the optimal Θ(lognloglogn)\Theta(\frac{\log n}{\log \log n}) time in expectation and with high probability. Further, the algorithm that we present is still optimal for any m[n,nlogn]m \in [n, n \log n] balls and can also be used as a building block to efficiently simulate more involved load balancing algorithms. In particular, for the Two-Choice algorithm, which samples two bins in each step and allocates to the least-loaded of the two, we obtain roughly a quadratic speed-up over the na\"{i}ve simulation.

Keywords

Cite

@article{arxiv.2404.07011,
  title  = {An asymptotically optimal algorithm for generating bin cardinalities},
  author = {Luc Devroye and Dimitrios Los},
  journal= {arXiv preprint arXiv:2404.07011},
  year   = {2024}
}

Comments

11 pages

R2 v1 2026-06-28T15:49:57.673Z