1
$\begingroup$

I've come up with a problem as follow:

Given an integer $k > 1$, a queue $Q$ as a permutation of integers $1$ to $N$. You can apply an operation to the queue as follows:

  • split the queue into no more than $k$ subqueues by repeatedly moving the front element of the main queue to the back of one of the $k$ subqueues until the main queue is empty.
  • merge the $k$ subqueues into one by repeatedly moving the front element of one of the $k$ subqueues to the back of the main queue until all subqueues are empty.

The problem is how many number of operations are required to sort the queue into decreasing sequence.

For example: the case where $k = 2$ and $Q$ is 5 2 1 4 3, we can split the queue into

  1. 5 4 3
  2. 2 1

and merge into 5 4 3 2 1 in one operation.

Another example: the case where $k = 2$ and $Q$ is 5 1 2 4 3, we can split the queue into

  1. 5 4 3
  2. 1 2

and merge into 1 5 4 3 2 then split into

  1. 1
  2. 5 4 3 2

then merge into 5 4 3 2 1, using the operation two times. (There are other ways, but still they end up using at least two times.)

I think the operation is related to maintenance of the minimum number of increasing subsequences required to cover the queue. For better picture, I'd represent the queue as a poset of $\mathbb{N}_N$ with $a \preceq b$ if and only if $a \leq b$ and $Q(a) \geq Q(b)$. The minimum number of increasing subsequences required to cover the queue would be exactly the width of the poset. And by Dilworth's Theorem, it would be equal to the length of longest increasing subsequence of the queue as an array.

For simplicity, let's denote the minimum number of increasing subsequences required to cover the queue $Q$ as $\chi(Q)$. Obviously, this is the same as the width of poset $\mathbb{N}_N, \preceq$. Also, for simplicity, let's call this the width of the queue. As stated by Dilworth's Theorem, $\chi(Q) = |LIS(Q)|$, where $|LIS(Q)|$ denotes the length of longest increasing subsequence of $Q$ as an array.

I've come up with a conjecture that in each operation, if done efficiently, would reduce the width by about a factor of $\frac{1}{k}$. That is, there exists an algorithm satisfying the conditions of an operation such that $\chi(Q) \mapsto \left\lceil\frac{\chi(Q)}{k}\right\rceil$.

It is not hard to see that if the conjecture is true, then the answer to the problem will be $\lceil \log_k{\chi(Q)} \rceil$.

My first intuition was that if we decompose the queue poset into $\chi(Q)$ chains, we should be able to group each $k$ chains together into $\left\lceil\frac{\chi(Q)}{k}\right\rceil$ groups of no more than $k$ chains, and each group could be merged to one in a single operation. I thought this is obviously proved, but it turns out to be unproved. There are cases where randomly grouping chains leads to collision, that is, the groups cannot be merged properly.

My next intuitions were about drawing Hasse diagrams as DAG and observe the properties of it. I thought that if each step of picking chains to form the decomposition, we try to pick the longest chain possible, then it should satisfy the conjecture. But this also turns out to be false. There are cases where groups cannot be merged properly.

Therefore, I'm looking for some proof (or disproof with counterexamples) about the stated conjecture.

$\endgroup$
4
  • $\begingroup$ How about decomposing the original sequence into decreasing subsequences in a greedy way (you always extend the first possible subsequence)? For example, (5 6 1 2 4 3 0) decomposes into (5 1, 6 2 0, 4 3). You then distribute these subsequnces into your k=2 queues in any "balanced" way without splitting any of those subsequences, for example 5 6 1 2 4 3 0 -> (5 6 1 2 0, 4 3) or (5 1 4 3, 6 2 0). Then you "mergesort" the k=2 queues into (5 6 4 3 1 2 0) or (6 5 2 1 4 3 0). After one more iteration you get (6 5 4 3 2 1 0). I think this should work, are there any counterexamples? $\endgroup$ Commented Jun 8, 2021 at 12:56
  • $\begingroup$ A colleague of mine found a counterexample (13 17 12 14 3 19 16 11 1 8 9 10 5 18 4 6 15 7 0 2) for k=2. Here, by always extending the first possible subsequence, we end up with 5 chains: (13 12 3 1 0, 17 14 11 8 5 4 2, 19 16 9 6, 10 7, 18 15). Let's pack the first, third, and fifth chains together to be (13 12 3 19 16 1 9 18 6 15 0) and then pack the second and fourth chains to (17 14 11 8 10 5 4 7 2). Keep in mind that here we want to merge the first with the second, and merge the third with the fourth, and leave the fifth as it was. It fails during "mergesort" at (17 14 13 12 11 8 *). $\endgroup$ Commented Jun 8, 2021 at 16:04
  • $\begingroup$ I wrote a small program to search for counterexamples for k = 2, and the shortest it found is (1 8 3 9 5 10 7 2 4 6). The longest increasing sub sequence has length 4. It seems that it's not possible to reduce that length to 2 by a single application of the operation from your question. Of course, my program can be buggy, so I'd appreciate if you could verify this. $\endgroup$ Commented Jun 9, 2021 at 0:22
  • $\begingroup$ That sounds right. I'll inform this to my colleague and will investigate this more. Thanks. $\endgroup$ Commented Jun 9, 2021 at 2:33

0

You must log in to answer this question.

Browse other questions tagged .