🤖 AI Summary
This paper studies the problem of reordering a length-$$n$$ sequence using $$k$$ parallel FIFO queues to enhance its sortedness. When the input’s longest decreasing subsequence (LDS) exceeds $$k$$, full sorting is impossible; thus, we focus on two core objectives: LDS reduction and minimization of descent steps. Theoretically, we establish the exact LDS-reduction limit achievable with $$k$$ queues: the LDS can be reduced to at most $$L - k + 1$$, and we provide tight upper and lower bounds. We propose a linear-time greedy algorithm that is optimal for minimizing descent steps. Motivated by mergeability requirements in automotive sequencing, we derive necessary and sufficient conditions for achieving LDS ≤ 2 using two queues, and design an $$O(n)$$-time algorithm to decide whether two sequences are mergeable under this constraint. Our work integrates combinatorial analysis, FIFO queue modeling, and scheduling theory, delivering both theoretical rigor and practical applicability.
📝 Abstract
Patience Sort sorts a sequence of numbers with a minimal number of queues that work according to the First-In-First-Out (FIFO) principle. More precisely, if the length of the longest descreasing subsequence of the input sequence is $L$, then Patience Sort uses $L$ queues. We ask how much one can improve order with $k$ queues, where $k<L$? We address this question for two measures of sortedness: number of down-steps and length of the longest descreasing subsequence. For the first measure, we give an optimal algorithm. For the second measure, we give an algorithm that reduces the LDS from $L$ to $L - k + 1$, and we provide a sequence with LDS $L$ that can't be reduced to an LDS lower than $L - k + 1$ with $k$ queues. Moreover, we study the mergeability of two sequences of numbers, providing an optimal linear algorithm for two queues with LDS $leq 2$. The research was inspired by a problem arising in car manufacturing.