A sock ordering is a sequence of socks with different colors. A sock ordering is foot-sortable if the sequence of socks can be sorted by a stack so that socks with the same color form a contiguous block. The problem of deciding whether a given sock ordering is foot-sortable was first considered by Defant and Kravitz, who resolved the case for alignment-free 2-uniform sock orderings. In this paper, we resolve the problem in a more general setting, where each color appears in the sock ordering at most twice. A key component of the argument is a fast algorithm that determines the foot-sortability of a sock ordering of length $N$ in time $O(N\log N)$, which is also an interesting result on its own.
翻译:袜子序列是指由不同颜色袜子组成的序列。若该序列可通过一个栈进行排序,使得相同颜色的袜子形成连续块,则称该袜子序列是足部可排序的。Defant与Kravitz首次研究了给定袜子序列是否足部可排序的判定问题,并解决了无对齐2一致袜子序列的特殊情况。本文在更一般的设定下解决了该问题,其中每种颜色在袜子序列中至多出现两次。论证的关键组成部分是一个快速算法,该算法能在O(N log N)时间内确定长度为N的袜子序列的足部可排序性,这本身也是一个有趣的结果。