The online monotone array completion problem

2026-06-30Data Structures and Algorithms

Data Structures and Algorithms
AI summary

The authors study a game where you try to fill an array with numbers between 0 and 1, placing them in order without changing previous entries. They find the best expected time to fill the array grows roughly like half of n times the log of n, improving on simpler known strategies. They prove no method can be much faster than this and provide a method matching it. They also explore a version where numbers can be replaced, showing it can be completed notably faster.

online algorithmsuniform distributionnon-decreasing sequencesexpected completion timecoupon collector problemrandomized algorithmsadaptive strategiesarray filling problemprobabilistic analysiswith-replacement model
Authors
Vishesh Jain, Dylan King, Clayton Mizgerd
Abstract
Consider the following online filling game. An array of length $n$ is initially empty. At each time step one observes an independent sample from $\mathrm{Unif}[0,1]$ and must either discard it or place it irrevocably into an empty position of the array, while preserving the constraint that the occupied entries are non-decreasing from left to right. Among all possible strategies, what is the optimal expected time required to fill the array? Let $v_n$ denote this optimal expected completion time. Our main result determines $v_n$ up to lower-order terms: \[ v_n=\left(\frac12+o(1)\right)n\log n. \] More precisely, no strategy, even if randomized and adaptive, can have expected completion time below $\left(\frac12-o(1)\right)n\log n$, while we provide an explicit deterministic strategy whose expected completion time is at most $\left(\frac12+o(1)\right)n\log n$. For comparison, the natural coupon-collector strategy, which partitions $[0,1]$ into $n$ equal intervals and reserves one array position for each interval, has expected completion time $(1+o(1))n\log n$. We also consider a with-replacement version of the game, in which previously placed entries may be overwritten. For this variant, we give a deterministic strategy with expected completion time $O(n\sqrt{\log n})$, thereby establishing a separation between the two models.