In the online sorting problem, $n$ items are revealed one by one and have to be placed (immediately and irrevocably) into empty cells of a size-$n$ array. The goal is to minimize the sum of absolute differences between items in consecutive cells. This natural problem was recently introduced by Aamand, Abrahamsen, Beretta, and Kleist (SODA 2023) as a tool in their study of online geometric packing problems. They showed that when the items are reals from the interval $[0,1]$ a competitive ratio of $O(\sqrt{n})$ is achievable, and no deterministic algorithm can improve this ratio asymptotically. In this paper, we extend and generalize the study of online sorting in three directions: - randomized: we settle the open question of Aamand et al. by showing that the $O(\sqrt{n})$ competitive ratio for the online sorting of reals cannot be improved even with the use of randomness; - stochastic: we consider inputs consisting of $n$ samples drawn uniformly at random from an interval, and give an algorithm with an improved competitive ratio of $\widetilde{O}(n^{1/4})$. The result reveals connections between online sorting and the design of efficient hash tables; - high-dimensional: we show that $\widetilde{O}(\sqrt{n})$-competitive online sorting is possible even for items from $\mathbb{R}^d$, for arbitrary fixed $d$, in an adversarial model. This can be viewed as an online variant of the classical TSP problem where tasks (cities to visit) are revealed one by one and the salesperson assigns each task (immediately and irrevocably) to its timeslot. Along the way, we also show a tight $O(\log{n})$-competitiveness result for uniform metrics, i.e., where items are of different types and the goal is to order them so as to minimize the number of switches between consecutive items of different types.
翻译:在线排序问题中,$n$个物品按序逐个出现,必须被立即且不可更改地放置到大小为$n$的数组空位中。目标是最小化连续单元格中物品间绝对差值的总和。这个自然的问题最近由Aamand、Abrahamsen、Beretta和Kleist(SODA 2023)提出,作为他们研究在线几何装箱问题的工具。他们证明当物品为区间$[0,1]$内的实数时,可实现$O(\sqrt{n})$的竞争比,且任何确定性算法都无法渐近改进该比率。本文从三个方向拓展和推广了在线排序的研究:- 随机化:我们通过证明即使使用随机性也无法改进实数在线排序的$O(\sqrt{n})$竞争比,解决了Aamand等人的开放性问题;- 随机输入:我们考虑从区间均匀随机抽取$n$个样本构成的输入,并给出竞争比为$\widetilde{O}(n^{1/4})$的改进算法。该结果揭示了在线排序与高效哈希表设计之间的联系;- 高维情形:我们证明即使对于任意固定维度$d$中来自$\mathbb{R}^d$的物品,在对抗模型下也能实现$\widetilde{O}(\sqrt{n})$竞争的在线排序。这可视为经典旅行商问题的在线变体,其中任务(待访问城市)逐个出现,销售人员将每个任务立即且不可更改地分配到其时间槽。在此过程中,我们还针对均匀度量(即物品属于不同类别,目标是通过排序最小化连续不同类别物品间的切换次数)给出了紧致的$O(\log{n})$竞争比结果。