用队列改进顺序
Improving Order with Queues
AI总结:
研究在队列数量不足时如何用并行FIFO队列将序列尽量接近排序状态,提出了基于Patience Sort的最优LDS缩减算法,刻画了LDS为2的序列合并条件,并给出减少下降步数的最优在线算法。
摘要:
给定一个由 $n$ 个数字组成的序列和 $k$ 个并行的先进先出 (FIFO) 队列,能将该序列在多大程度上接近已排序状态?已知若输入序列的最长递减子序列 (LDS) 至多为 $k$,则 $k$ 个队列足以对序列进行排序。但是,如果队列数量太少而无法完全排序,情况会怎样?\n - 我们给出了一种基于 Patience Sort 的简单算法,可将 LDS 减少 $k - 1$。我们还证明了该算法是最优的,即对于任意 $L > 0$,存在一个 LDS 为 $L$ 的序列,使得使用 $k$ 个队列无法将其 LDS 减少到 $L - k + 1$ 以下。\n - 合并两个已排序的队列是 Merge Sort 的核心。相比之下,两个 LDS 为 2 的序列并不总是能合并为一个 LDS 为 2 的序列。我们刻画了何时可以合并,并给出了一种算法来判断其是否可行。将其合并为 LDS 为 3 的序列始终是可行的。\n - 序列中的下降步是指一个元素紧跟着一个比它小的元素。我们给出了一种用于减少下降步数的最优算法。该算法是在线的。\n 我们的研究受到汽车制造业中一项应用的启发。
英文摘要:
Given a sequence of $n$ numbers and $k$ parallel First-in-First-Out (FIFO) queues, how close can one bring the sequence to sorted order? It is known that $k$ queues suffice to sort the sequence if the Longest Decreasing Subsequence (LDS) of the input sequence is at most $k$. But, what if the number of queues is too small for sorting completely? - We give a simple algorithm, based on Patience Sort, that reduces the LDS by $k - 1$. We also show, that the algorithm is optimal, i.e., for any $L > 0$ there exists a sequence of LDS $L$ such that the LDS cannot be reduced below $L - k + 1$ with $k$ queues. - Merging two sorted queues is at the core of Merge Sort. In contrast, two sequences of LDS two cannot always be merged into a sequence of LDS two. We characterize when it is possible and give an algorithm to decide whether it is possible. Merging into a sequence of LDS three is always possible. - A down-step in a sequence is an item immediately followed by a smaller item. We give an optimal algorithm for reducing the number of down-steps. The algorithm is online. Our research was inspired by an application in car manufacturing.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。