Improving Order with Queues
Authors:
Andreas Karrenbauer,
Leonie Wennmann,
Kurt Mehlhorn,
Pranabendu Misra,
Paolo Luigi Rinaldi,
Anna Twelsiek,
Siavash Rahimi Shateranloo,
Alireza Haqi
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:…
▽ More
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.
△ Less
Submitted 30 June, 2023; v1 submitted 6 July, 2022;
originally announced July 2022.