This paper was converted on www.awesomepapers.org from LaTeX by an anonymous user.
Want to know more? Visit the Converter page.

An Upper Bound for Sorting RnR_{n} with LRE

Sai Satwik Kuppili1 and Bhadrachalam Chitturi2 2Dept. of Computer Science, University of Texas at Dallas
Texas, USA
1VMware Inc. Pune, India
1 Dept. of Computer Science and Engineering, Amrita University
Amritapuri, India
Email: [email protected], [email protected]
Abstract

A permutation π\pi over alphabet Σ=1,2,3,,n\Sigma={1,2,3,\ldots,n}, is a sequence where every element xx in Σ\Sigma occurs exactly once. SnS_{n} is the symmetric group consisting of all permutations of length nn defined over Σ\Sigma. InI_{n} = (1,2,3,,n)(1,2,3,\ldots,n) and Rn=(n,n1,n2,,2,1)R_{n}=(n,n-1,n-2,\ldots,2,1) are identity (i.e. sorted) and reverse permutations respectively. An operation, that we call as an LRELRE operation, has been defined in OEIS with identity A186752. This operation is constituted by three generators: left-rotation, right-rotation and transposition(1,2). We call transposition(1,2) that swaps the two leftmost elements as ExchangeExchange. The minimum number of moves required to transform RnR_{n} into InI_{n} with LRELRE operation are known for n11n\leq 11 as listed in OEIS with sequence number A186752. For this problem no upper bound is known. OEIS sequence A186783 gives the conjectured diameter of the symmetric group SnS_{n} when generated by LRELRE operations [1]. The contributions of this article are: (a) The first non-trivial upper bound for the number of moves required to sort RnR_{n} with LRELRE; (b) a tighter upper bound for the number of moves required to sort RnR_{n} with LRELRE; and (c) the minimum number of moves required to sort R10R_{10} and R11R_{11} have been computed. Here we are computing an upper bound of the diameter of Cayley graph generated by LRELRE operation. Cayley graphs are employed in computer interconnection networks to model efficient parallel architectures. The diameter of the network corresponds to the maximum delay in the network.

Index Terms:
Permutation, Sorting, Left Rotate, Right Rotate, Exchange, Symmetric Group, Upper Bound, Cayley Graphs.
111This article is submitted to 10th International Advanced Computing Conference, IACC-2020.

I Introduction

The following problem is from OEIS with sequence number A186752: “Length of minimum representation of the permutation [n,n1,,1][n,n-1,\ldots,1] as the product of transpositions (1,2)(1,2) and left and right rotations (1,2,,n)(1,2,\ldots,n). [1].” We call this operation as LRELRE. LRELRE operation consists of following three generators: (i) LeftRotateLeftRotate that cyclically shifts all elements to left by one position, (ii) RightRotateRightRotate that cyclically shifts all elements to right by one position and (iii) ExchangeExchange that swaps the leftmost two elements of the permutation. The mentioned operations are abbreviated as LL, RR and EE respectively. RnR_{n} denotes (n,n1,.,2,1)(n,n-1,....,2,1) whereas InI_{n} denotes the sorted order or identity permutation: (1,2,,n)(1,2,\ldots,n). Sorting a permutation π\pi in this article refers to transforming π\pi into InI_{n} with LRELRE operation. The alphabet is Σ=(1,2,3,,n)\Sigma=(1,2,3,\ldots,n). [2, 3] studied a more restricted version of this problem, i.e. LELE operation where the operation RR is disallowed and appears in OEIS with sequence number A048200 [1]. We note that the results of [2, 3] are applicable to RERE operation (that has not been studied) due to symmetry. We seek to obtain an upper bound on the length of generator sequence that transforms RnR_{n} with LRELRE into InI_{n}.
The optimum number of moves to sort RnR_{n} with LRELRE are known only for n11n\leq 11 (n=10n=10 and n=11n=11 are our contributions). We give the first non-trivial upper bound to sort RnR_{n} with LRELRE.

Let π[1n]\pi[1\cdots n] be the array containing the input permutation. The element at an index ii is denoted by π[i]\pi[i]. Initially for all ii, π[i]=Rn[i]\pi[i]=R_{n}[i]. We define a permutation Kr,nSnK_{r,n}\in S_{n} as follows. The elements n(r1),n(r2),nn-(r-1),n-(r-2),\ldots n are in sorted order i.e. the largest rr elements of Σ\Sigma are in sorted order. Kr,nK_{r,n} is obtained by concatenating sublists (n(r1),n(r2),n)(n-(r-1),n-(r-2),\ldots n) and (nr,n(r+1),3,2,1)(n-r,n-(r+1),\ldots 3,2,1). Therefore a permutation Kr,nK_{r,n} can be denoted as follows (n(r1),n(r2),n,nr,n(r+1),3,2,1)(n-(r-1),n-(r-2),\ldots n,n-r,n-(r+1),\ldots 3,2,1).
Therefore, K1,nK_{1,n} is (n,n1,3,2,1)(n,n-1,\ldots 3,2,1) which is RnR_{n} and Kn,nK_{n,n} (1,2,,n1,n)(1,2,\ldots,n-1,n) which is InI_{n}. Let LELE denote execution of Left-Rotate move followed by a Exchange move and RERE denote execution of Right-Rotate move followed by a Exchange move. Further, let (LE)p(LE)^{p} and (RE)p(RE)^{p} be pp consecutive executions of RERE and RERE respectively. Similarly, let LpL^{p} and RpR^{p} be pp consecutive executions of LL and RR respectively.

I-A Background

A Cayley graph Γ\Gamma defined on Symmetric group SnS_{n}, corresponding to an operation Ψ\Psi with a generator set GG has n!n! vertices each vertex corresponding to a unique permutation. An edge in Γ\Gamma from a vertex uu to another vertex vv indicates that there exits a generator gGg\in G such that when gg is applied to uu one obtains vv. Applying a generator is called as making a move. An upper bound of xx moves to sort any permutation in SnS_{n} indicates that the diameter of Γ\Gamma is at most xx. An exact upper bound equals the diameter of Γ\Gamma. Cayley graphs have many properties that render them apt for computer interconnection networks [4, 5]. Various operations to sort permutations have been posed that are of theoretical and practical interest [5].

Jerrum showed that when the number of generators is greater than one, the computation of minimum length of sequence of generators to sort a permutation is intractable [14]. LRELRE operation has three generators and the complexity of transforming one permutation in to another with LRELRE unknown. Exchange move is a reversal of length two, in fact it is a prefix reversal of length two.

For sorting permutations with (unrestricted) prefix reversals the operation that has n1n-1 generators, the best known upper bound is 18n/11+O(1)18n/11+O(1) [9]. In LRELRE operation, both left and right rotate cyclically shifts the entire permutation. In contrast, [12] an extended bubblesort is considered, where an additional swap is allowed between elements in positions 1 and nn. We call an operation say Ψ\Psi symmetric if for any generator of Ψ\Psi its inverseinverse is also in Ψ\Psi. Exchange operation is inverse of itself whereas left and right rotate are inverses of one another, thus, LRELRE is symmetric. Both LELE and LRELRE are restrictive compared to the other operations that are studied in the context of genetics e.g. [6]. Research in the area of Cayley graphs has been active. Cayley graphs are studied pertaining to their efficacy in modelling a computer interconnection network, their properties in terms of diameter, presence of greedy cycles in them etc. [15, 11, 13]. Efficient computation of all distances, some theoretical properties of specific Cayley graphs, and efficient counting of groups of permutations in SnS_{n} with related properties have been recently studied [7, 16, 8, 10].

II Algorithm LRE

Algorithm LRELRE sorts RnR_{n} in stages. It first transforms RnR_{n} which is identical to K1,nK_{1,n} into K2,nK_{2,n} by executing an EE move. Subsequently, Ki+1,nK_{i+1,n} is obtained from Ki,nK_{i,n} by executing the moves specified by Lemma 1. Thus, eventually we obtain Kn,nK_{n,n} which is identical to InI_{n}. Pseudo Code for the Algorithm LRELRE is shown below.

Algorithm LRE
Input: RnR_{n}. Output: InI_{n}.
Initialization:i\forall{i} π[i]=Rn[i]\pi[i]=R_{n}[i].
All moves are executed on π\pi.

1:  for r(1,,n2)r\in(1,\ldots,n-2) do
2:     if r=(n2)r=(n-2) then
3:        Execute R2R^{2}
4:        Execute E move
5:     else
6:        Execute (L)r1(L)^{r-1}
7:        Execute E move
8:        Execute (RE)r1(RE)^{r-1}
9:     end if
10:  end for
Algorithm 1 Algorithm LRE

II-A Analysis

Lemma 1.

The number of moves required to obtain Kr+1,nK_{r+1,n} from Kr,nr(1,,n3)K_{r,n}\forall r\in(1,\ldots,n-3) is 3r23r-2.

Proof.

According to the definition, Kr,nK_{r,n} is
(n(r1),n(r2),n1,n,nr,n(r+1),n(r+2),3,2,1)(n-(r-1),n-(r-2),\ldots n-1,n,n-r,n-(r+1),n-(r+2),\ldots 3,2,1).
Executing Lr1L^{r-1} on Kr,nK_{r,n} yields
(n,nr,n(r+1),n(r+2),3,2,1,n(r1),n(r2),n1)(n,n-r,n-(r+1),n-(r+2),\ldots 3,2,1,n-(r-1),n-(r-2),\ldots n-1).
An E move is executed to obtain
(nr,n,n(r+1),n(r+2),3,2,1,n(r1),n(r2),n1)(n-r,n,n-(r+1),n-(r+2),\ldots 3,2,1,n-(r-1),n-(r-2),\ldots n-1).
Finally, (RE)r1(RE)^{r-1} is executed to obtain
(nr,n(r1),n(r2),n1,n,n(r+1),n(r+2),3,2,1)(n-r,n-(r-1),n-(r-2),\ldots n-1,n,n-(r+1),n-(r+2),\ldots 3,2,1) which is Kr+1,nK_{r+1,n}.
Therefore, the total number of moves required to obtain Kr+1,nK_{r+1,n} from Kr,nK_{r,n} is (r1)+1+2(r1)=3r2(r-1)+1+2(r-1)=3r-2. ∎

Lemma 2.

The number of moves required to obtain Kn,nK_{n,n} from Kn2,nK_{n-2,n} is 3.

Proof.

According to the definition, Kn2,nK_{n-2,n} is
(3,4,,n1,n,2,1)(3,4,\ldots,n-1,n,2,1). Executing R2R^{2} on Kn2,nK_{n-2,n} yields
(2,1,3,,n1,n)(2,1,3,\ldots,n-1,n). Then executing an EE move yields (1,2,3,n1,n)(1,2,3\ldots,n-1,n) which is Kn,nK_{n,n}. Therefore, three moves suffice to transform Kn2,nK_{n-2,n} into Kn,nK_{n,n}. ∎

Theorem 3.

An upper bound for the number of moves required to sort RnR_{n} with LRELRE is 32n2\frac{3}{2}n^{2}.

Proof.

Let J(n)J(n) be the number of moves required to sort RnR_{n} with LRELRE. According to Lemma 1, the number of moves required to obtain Kr+1,nK_{r+1,n} from Kr,nK_{r,n} is 3r23r-2. Let A(n)A(n) be the number of moves required to obtain Kn2,nK_{n-2,n} from K1,nK_{1,n} (which is RnR_{n}). Then

A(n)=r=1n3(3r2)=3r=1n3r(2(n3))=32(n2)(n3)2n+6=32(n25n+6)2n+6=32n2152n+92n+6=32n2192n+15\begin{split}A(n)&=\sum\limits_{r=1}^{n-3}(3r-2)\\ &=3\sum\limits_{r=1}^{n-3}r-(2(n-3))\\ &=\frac{3}{2}(n-2)(n-3)-2n+6\\ &=\frac{3}{2}(n^{2}-5n+6)-2n+6\\ &=\frac{3}{2}n^{2}-\frac{15}{2}n+9-2n+6\\ &=\frac{3}{2}n^{2}-\frac{19}{2}n+15\\ \end{split}

According to Lemma 2, the number of moves required to obtain Kn,nK_{n,n} from Kn2,nK_{n-2,n} is 3. Therefore,

J(n)=A(n)+3=32n2192n+18\begin{split}J(n)&=A(n)+3\\ &=\frac{3}{2}n^{2}-\frac{19}{2}n+18\end{split}

Therefore, the total number of moves required to sort RnR_{n} with LRELRE is 32n2192n+18\frac{3}{2}n^{2}-\frac{19}{2}n+18. Ignoring the lower order terms an upper bound for number of moves required to sort RnR_{n} with LRELRE is 3n22\frac{3n^{2}}{2}. This is the first non-trivial upper bound for the number of moves required to sort RnR_{n} with LRELRE. ∎

III Algorithm LRE1


We designed Algorithm LRE1LRE1 in order to obtain the tighter upper bound for sorting RnR_{n} with LRELRE. We define a permutation Kr,nSnK_{r,n}^{{}^{\prime}}\in S_{n} as follows. The largest rr elements of Σ\Sigma i.e. n(r1),n(r2),nn-(r-1),n-(r-2),\ldots n are in sorted order. Kr,nK_{r,n}^{{}^{\prime}} is obtained by concatenating sublists (nr,n(r+1),3,2,1)(n-r,n-(r+1),\ldots 3,2,1) and (n(r1),n(r2),n)(n-(r-1),n-(r-2),\ldots n). Kr,nK_{r,n} and Kr,nK_{r,n}^{{}^{\prime}} differ by the starting position of sublist (n(r1),n(r2),n)(n-(r-1),n-(r-2),\ldots n). The starting position of (n(r1),n(r2),n)(n-(r-1),n-(r-2),\ldots n) in Kr,nK_{r,n} is 1 whereas in Kr,nK_{r,n}^{{}^{\prime}} it is nr+1n-r+1. Algorithm LRE1LRE1 first transforms RnR_{n} into Kn2,nK_{\lfloor\frac{n}{2}\rfloor,n}^{{}^{\prime}}. Then it transforms Kn2,nK_{\lfloor\frac{n}{2}\rfloor,n}^{{}^{\prime}} into Kn,nK_{n,n}^{{}^{\prime}} which is InI_{n}. Let k=n2k=\lfloor\frac{n}{2}\rfloor and k=nkk^{\prime}=n-k. Let J(n)J^{\prime}(n) be the number of moves executed by Algorithm LRE1LRE1 to sort RnR_{n}.

Input: RnR_{n}. Output: InI_{n}.
Initialization:i\forall{i} π[i]=Rn[i]\pi[i]=R_{n}[i]. k=n2k=\lfloor\frac{n}{2}\rfloor, k=nk=n2k^{\prime}=n-k=\lceil\frac{n}{2}\rceil
All moves are executed on π\pi.

1:  D1:
2:  if k1k\not=1 then
3:     Execute E move
4:  end if
5:  if k3k\geq 3 then
6:     D2:
7:     Execute (LE)k2(LE)^{k-2}
8:     Execute (RE)k2(RE)^{k-2}
9:     Execute L move
10:     D3:
11:     if k4k\geq 4 then
12:        for i(0,,k1)i\in(0,\ldots,k-1) do
13:           if π[1]=(n1)\pi[1]=(n-1) then
14:              Execute E move
15:              if ii\geqthen
16:                 Execute (RE)i1(RE)^{i-1}
17:              end if
18:           end if
19:           Execute (L)i(L)^{i}
20:        end for
21:     end if
22:  end if
23:  D4:
24:  if k1k\not=1 then
25:     Execute (L)2(L)^{2}
26:  else
27:     Execute L move
28:  end if
29:  D5:
30:  Execute E move
31:  if k3k^{\prime}\geq 3 then
32:     D6:
33:     Execute (LE)k2(LE)^{k^{\prime}-2}
34:     Execute (RE)k2(RE)^{k^{\prime}-2}
35:     if k4k^{\prime}\geq 4 then
36:        D7:
37:        Execute L move
38:        D8:
39:        for i(0,,k1)i\in(0,\ldots,k^{\prime}-1) do
40:           if π[1]=(k1)\pi[1]=(k^{\prime}-1) then
41:              Execute E move
42:              if ii\geqthen
43:                 Execute (RE)i1(RE)^{i-1}
44:              end if
45:           end if
46:           if i(k3)i\not=(k^{\prime}-3) then
47:              Execute (L)i(L)^{i}
48:           end if
49:        end for
50:        D9:
51:        Execute R move
52:     end if
53:  end if
Algorithm 2 Algorithm LRE1

III-A Analysis

Lemma 4.

The permutation obtained after executing D1 and D2 of Algorithm LRE1 is
(n1,n2,,n2+2,n,n2,n21,3,2,1,n2+1)(n-1,n-2,\ldots,\lceil\frac{n}{2}\rceil+2,n,\lceil\frac{n}{2}\rceil,\lceil\frac{n}{2}\rceil-1,\ldots 3,2,1,\lceil\frac{n}{2}\rceil+1) and the number of moves executed is 2n62n-6 when n is even and 2n82n-8 when n is odd n6\forall n\geq 6.

Proof.

Execution of E move on RnR_{n} in D1D1 yields
(n1,n,n2,,3,2,1)(n-1,n,n-2,\ldots,3,2,1).
Then executing (LE)k2(LE)^{k-2} in D2D2 yields
(n2+1,n,n2,n21,3,2,1,n1,n2,,n2+2)(\lceil\frac{n}{2}\rceil+1,n,\lceil\frac{n}{2}\rceil,\lceil\frac{n}{2}\rceil-1,\ldots 3,2,1,n-1,n-2,\ldots,\lceil\frac{n}{2}\rceil+2).
Then executing (RE)k2(RE)^{k-2} in D2D2 yields
(n2+1,n1,n2,,n2+2,n,n2,n21,3,2,1)(\lceil\frac{n}{2}\rceil+1,n-1,n-2,\ldots,\lceil\frac{n}{2}\rceil+2,n,\lceil\frac{n}{2}\rceil,\lceil\frac{n}{2}\rceil-1,\ldots 3,2,1).
Then performing LL in D2D2 move yields
(n1,n2,,n2+2,n,n2,n21,3,2,1,n2+1)(n-1,n-2,\ldots,\lceil\frac{n}{2}\rceil+2,n,\lceil\frac{n}{2}\rceil,\lceil\frac{n}{2}\rceil-1,\ldots 3,2,1,\lceil\frac{n}{2}\rceil+1).
Therefore, the total number of moves executed in step D1D1 and D2D2 is
1+4(n22)+1=4n26=1+4*(\lfloor\frac{n}{2}\rfloor-2)+1=4\lfloor\frac{n}{2}\rfloor-6= {2n6if n is even2n8if n is odd.\begin{cases}2n-6&\text{if $n$ is even}\\ 2n-8&\text{if $n$ is odd}\end{cases}.\\

Lemma 5.

The permutation obtained after D3 and D4 of LRE1 algorithm are executed is Kn2,nK_{\lfloor\frac{n}{2}\rfloor,n}^{{}^{\prime}} and the number of moves executed in the above two steps is 3n234n+1128\frac{3n^{2}-34n+112}{8} when n is even and 3n240n+1498\frac{3n^{2}-40n+149}{8} when n is odd n8\forall n\geq 8.

Proof.

From Lemma 4, the permutation obtained after steps D1D1 and D2D2 is
(n1,n2,,n2+2,n,n2,n21,3,2,1,n2+1)(n-1,n-2,\ldots,\lceil\frac{n}{2}\rceil+2,n,\lceil\frac{n}{2}\rceil,\lceil\frac{n}{2}\rceil-1,\ldots 3,2,1,\lceil\frac{n}{2}\rceil+1).
When i=0i=0 in step D3D3 only EE move is executed and permutation thus obtained is
(n2,n1,,n2+2,n,n2,n21,3,2,1,n2+1)(n-2,n-1,\ldots,\lceil\frac{n}{2}\rceil+2,n,\lceil\frac{n}{2}\rceil,\lceil\frac{n}{2}\rceil-1,\ldots 3,2,1,\lceil\frac{n}{2}\rceil+1).
When i=1i=1 in step D3D3 only LL move is executed and permutation thus obtained is
(n1,,n2+2,n,n2,n21,3,2,1,n2+1,n2)(n-1,\ldots,\lceil\frac{n}{2}\rceil+2,n,\lceil\frac{n}{2}\rceil,\lceil\frac{n}{2}\rceil-1,\ldots 3,2,1,\lceil\frac{n}{2}\rceil+1,n-2).
There after in each iteration in step D3D3, EE move, (RE)i1(RE)^{i-1} and LiL^{i} are executed so that the elements between π[1]\pi[1] and π[ni+2]\pi[n-i+2] are left rotated. Thus, the permutation obtained after step D3D3 is (n1,n,n2,n21.,2,1,n2+1,,n2)(n-1,n,\lceil\frac{n}{2}\rceil,\lceil\frac{n}{2}\rceil-1.\dots,2,1,\lceil\frac{n}{2}\rceil+1,\ldots,n-2) and the number of moves executed in each iteration is 1+2(i1)+i=3i11+2(i-1)+i=3i-1.
Therefore, the total number of moves executed in step D3D3 is
1+1+j=2n23(3j1)=2+i=2n23(3i1)=1+1+\sum_{j=2}^{\lfloor\frac{n}{2}\rfloor-3}(3j-1)\\ =2+\sum_{i=2}^{\lfloor\frac{n}{2}\rfloor-3}(3i-1)\\ = {3n234n+968if n is even3n240n+1338if n is odd\begin{cases}\frac{3n^{2}-34n+96}{8}&\text{if $n$ is even}\\ \frac{3n^{2}-40n+133}{8}&\text{if $n$ is odd}\\ \end{cases}
Execution of L2L^{2} in step D4D4 yields
(n2,n21.,2,1,n2+1,,n2,n1,n)(\lceil\frac{n}{2}\rceil,\lceil\frac{n}{2}\rceil-1.\dots,2,1,\lceil\frac{n}{2}\rceil+1,\ldots,n-2,n-1,n) which is Kn2,nK_{\lfloor\frac{n}{2}\rfloor,n}^{{}^{\prime}}. Therefore, the total number of moves executed in steps D3D3 and D4D4 are {3n234n+1128if n is even3n240n+1498if n is odd\begin{cases}\frac{3n^{2}-34n+112}{8}&\text{if $n$ is even}\\ \frac{3n^{2}-40n+149}{8}&\text{if $n$ is odd}\\ \end{cases}.

Lemma 6.

The permutation obtained after executing D5 and D6 of LRE1 algorithm is
(1,n21,n22,,2,n2,n2+1,n2+2,,n1,n)(1,\lceil\frac{n}{2}\rceil-1,\lceil\frac{n}{2}\rceil-2,\ldots,2,\lceil\frac{n}{2}\rceil,\lceil\frac{n}{2}\rceil+1,\lceil\frac{n}{2}\rceil+2,\ldots,n-1,n) and the number of moves executed in the above two steps is 2n72n-7 when n is even and 2n52n-5 when n is odd n5\forall n\geq 5.

Proof.

According to Lemma 5, the permutation obtained after the steps D1D1 to D4D4 is
(n2,n21,n22,,2,1,n2+1,n2+2,,n1,n)(\lceil\frac{n}{2}\rceil,\lceil\frac{n}{2}\rceil-1,\lceil\frac{n}{2}\rceil-2,\ldots,2,1,\lceil\frac{n}{2}\rceil+1,\lceil\frac{n}{2}\rceil+2,\ldots,n-1,n).
Now, executing EE move in step D5D5 yields
(n21,n2,n22,,2,1,n2+1,n2+2,,n1,n)(\lceil\frac{n}{2}\rceil-1,\lceil\frac{n}{2}\rceil,\lceil\frac{n}{2}\rceil-2,\ldots,2,1,\lceil\frac{n}{2}\rceil+1,\lceil\frac{n}{2}\rceil+2,\ldots,n-1,n).
Then executing (LE)k2(LE)^{k^{\prime}-2} in step D6D6 yields
(1,n2,n2+1,n2+2,,n1,n,n21,n22,,2)(1,\lceil\frac{n}{2}\rceil,\lceil\frac{n}{2}\rceil+1,\lceil\frac{n}{2}\rceil+2,\ldots,n-1,n,\lceil\frac{n}{2}\rceil-1,\lceil\frac{n}{2}\rceil-2,\ldots,2).
Then executing (RE)k2(RE)^{k^{\prime}-2} in step D6D6 yields
(1,n21,n22,,2,n2,n2+1,n2+2,,n1,n)(1,\lceil\frac{n}{2}\rceil-1,\lceil\frac{n}{2}\rceil-2,\ldots,2,\lceil\frac{n}{2}\rceil,\lceil\frac{n}{2}\rceil+1,\lceil\frac{n}{2}\rceil+2,\ldots,n-1,n).
Therefore, the total number of moves executed in steps D5D5 and D6D6 is
1+4(k2)=4k7={2n7if n is even2n5if n is odd1+4(k^{\prime}-2)=4k^{\prime}-7=\begin{cases}2n-7&\text{if $n$ is even}\\ 2n-5&\text{if $n$ is odd}\end{cases}.

Lemma 7.

The permutation obtained after executing D7 and D8 of LRE1 algorithm is (2,3,,n1,n,1)(2,3,\ldots,n-1,n,1) and the number of moves executed in the above two steps is 3n238n+1288\frac{3n^{2}-38n+128}{8} when n is even and 3n232n+938\frac{3n^{2}-32n+93}{8} when n is odd n7\forall n\geq 7.

Proof.

According to Lemma 6, the permutation obtained after steps D1D1 to D6D6 is
(1,n21,n22,,2,n2,n2+1,n2+2,,n1,n)(1,\lceil\frac{n}{2}\rceil-1,\lceil\frac{n}{2}\rceil-2,\ldots,2,\lceil\frac{n}{2}\rceil,\lceil\frac{n}{2}\rceil+1,\lceil\frac{n}{2}\rceil+2,\ldots,n-1,n).
LL move is executed in step D7D7 and the permutation thus obtained is
(n21,n22,,2,n2,n2+1,n2+2,,n1,n,1)(\lceil\frac{n}{2}\rceil-1,\lceil\frac{n}{2}\rceil-2,\ldots,2,\lceil\frac{n}{2}\rceil,\lceil\frac{n}{2}\rceil+1,\lceil\frac{n}{2}\rceil+2,\ldots,n-1,n,1).
When i=0i=0 in step D8, only EE move is executed and the permutation thus obtained is
(n22,n21,,2,n2,n2+1,n2+2,,n1,n,1)(\lceil\frac{n}{2}\rceil-2,\lceil\frac{n}{2}\rceil-1,\ldots,2,\lceil\frac{n}{2}\rceil,\lceil\frac{n}{2}\rceil+1,\lceil\frac{n}{2}\rceil+2,\ldots,n-1,n,1).
When i=1i=1 in step D8, only LL move is executed and the permutation thus obtained is
(n21,,2,n2,n2+1,n2+2,,n1,n,1,n22)(\lceil\frac{n}{2}\rceil-1,\ldots,2,\lceil\frac{n}{2}\rceil,\lceil\frac{n}{2}\rceil+1,\lceil\frac{n}{2}\rceil+2,\ldots,n-1,n,1,\lceil\frac{n}{2}\rceil-2).
There after in each iteration in step D8D8 except when i=(k3)i=(k^{\prime}-3), EE move, (RE)i1(RE)^{i-1} and LiL^{i} are executed so that the elements between π[1]\pi[1] and π[ni+2]\pi[n-i+2] are left rotated. When i=k3i=k^{\prime}-3 only EE move and (RE)i1(RE)^{i-1} are executed. Thus, the obtained permutation after step D8D8 is (2,3,,n1,n,1)(2,3,\ldots,n-1,n,1). The number of moves executed in step D8D8 is
1+1+1+j=2n24(3j1)+1+2n24=4+j=2n24(3j1)+2n24={3n238n+1288if n is even3n232n+938if n is odd1+1+1+\sum_{j=2}^{\lceil\frac{n}{2}-4\rceil}(3j-1)+1+2*\lceil\frac{n}{2}-4\rceil\\ =4+\sum_{j=2}^{\lceil\frac{n}{2}-4\rceil}(3j-1)+2*\lceil\frac{n}{2}-4\rceil\\ =\begin{cases}\frac{3n^{2}-38n+128}{8}&\text{if $n$ is even}\\ \frac{3n^{2}-32n+93}{8}&\text{if $n$ is odd}\end{cases}.

Lemma 8.

Algorithm LRE1 is correct.

Proof.

According to Lemma 7, the permutation obtained after steps D1D1 to D8D8 is
(2,3,,n21,n2,n2+1,n2+2,,n1,n,1)(2,3,\ldots,\lceil\frac{n}{2}\rceil-1,\lceil\frac{n}{2}\rceil,\lceil\frac{n}{2}\rceil+1,\lceil\frac{n}{2}\rceil+2,\ldots,n-1,n,1).
Executing RR move in step D9D9 yields
(1,2,3,,n21,n2,n2+1,n2+2,,n1,n)(1,2,3,\ldots,\lceil\frac{n}{2}\rceil-1,\lceil\frac{n}{2}\rceil,\lceil\frac{n}{2}\rceil+1,\lceil\frac{n}{2}\rceil+2,\ldots,n-1,n) which is InI_{n}. Hence proves the lemma. ∎

Theorem 9.

The number of moves required to sort RnR_{n} with LRE1 algorithm is
J’(n) = {2if n=34if n=48if n=513if n=620if n=73n220n+724if n8 and n is even3n220n+734if n8 and n is odd\begin{cases}2&\text{if $n=3$}\\ 4&\text{if $n=4$}\\ 8&\text{if $n=5$}\\ 13&\text{if $n=6$}\\ 20&\text{if $n=7$}\\ \frac{3n^{2}-20n+72}{4}&\text{if $n\geq 8$ and $n$ is even}\\ \frac{3n^{2}-20n+73}{4}&\text{if $n\geq 8$ and $n$ is odd}\end{cases}.

Proof.

Case-i: nn is 3

When nn=3, the values of kk and kk^{\prime} are 1 and 2 respectively. So, only steps D1D1 and D4D4 are executed. Therefore, the number of moves executed are 1+1=21+1=2.

Case-ii: nn is 4

When nn=4, the values of both kk and kk^{\prime} is 2, So only steps D1D1, D4D4 and D5D5 are executed. Therefore, the total number of moves executed are 1+2+1=41+2+1=4.

Case-iii: nn is 5

When nn=5, the values of kk and kk^{\prime} are 2 and 3 respectively. So only steps D1D1, D4D4, D5D5 and D6D6 are executed. According to Lemma 6, the number of moves executed by steps D5D5 and D6D6 is 2n52n-5 when nn is odd. Therefore, the total number of moves executed are 1+2+2n5=2n2=81+2+2n-5=2n-2=8.

Case-iv: nn is 6

When nn=6, the values of both kk and kk^{\prime} is 3. Therefore steps D1D1, D2D2, D4D4, D5D5 and D6D6 are executed. According to Lemma 4, the number of moves executed by steps D1D1 and D2D2 is 2n62n-6 when nn is even. According to Lemma 6, the number of moves executed by steps D5D5 and D6D6 is 2n72n-7 when nn is even. Therefore, the total number of moves executed are 2n6+2+2n7=4n11=132n-6+2+2n-7=4n-11=13.

Case-v: nn is 7

When nn=7, the values of kk and kk^{\prime} are 3 and 4 respectively. Therefore steps D1D1, D2D2, D4D4, D5D5 and D6D6 are executed. According to Lemma 4, the number of moves executed by steps D1D1 and D2D2 is 2n82n-8 when nn is odd. The number of moves executed by step D4D4 is 2. According to Lemma 6, the number of moves executed by steps D5D5 and D6D6 is 2n52n-5 when nn is odd. According to Lemma 7, the number of moves executed by steps D7D7 and D8D8 is 3n232n+938\frac{3n^{2}-32n+93}{8} when nn is odd. Number of moves executed by step D9D9 is 1. Therefore, the total number of moves executed is 2n8+2+2n5+3n232n+938+1=4n11+3n232n+938+1=202n-8+2+2n-5+\frac{3n^{2}-32n+93}{8}+1=4n-11+\frac{3n^{2}-32n+93}{8}+1=20.

Case-vi: n8n\geq 8 and nn is even

In this case all steps from D1D1 to D9D9 are executed. According to Lemma 4, the number of moves executed by steps D1D1 and D2D2 is 2n62n-6 when nn is even. According to Lemma 5, the number of moves executed by steps D3D3 and D4D4 is 3n234n+1128\frac{3n^{2}-34n+112}{8} when nn is even. According to Lemma 6, the number of moves executed by steps D5D5 and D6D6 is 2n72n-7 when nn is even. According to Lemma 7, the number of moves executed by steps D7D7 and D8D8 is 3n238n+1288\frac{3n^{2}-38n+128}{8} when nn is even. Number of moves executed by step D9D9 is 1. Therefore, the total number of moves executed by Algorithm LRE1LRE1 is

J(n)=2n6+3n234n+1128+2n7+3n238n+1288+1=3n220n+724\begin{split}J^{\prime}(n)&=2n-6+\frac{3n^{2}-34n+112}{8}+2n-7+\frac{3n^{2}-38n+128}{8}+1\\ &=\frac{3n^{2}-20n+72}{4}\end{split}

Case-vii: n8n\geq 8 and nn is odd

In this case all steps from D1D1 to D9D9 are executed. According to Lemma 4, the number of moves executed by steps D1D1 and D2D2 is 2n82n-8 when nn is odd. According to Lemma 5, the number of moves executed by steps D3D3 and D4D4 is 3n240n+1498\frac{3n^{2}-40n+149}{8} when nn is odd. According to Lemma 6, the number of moves executed by steps D5D5 and D6D6 is 2n52n-5 when nn is odd. According to Lemma 7, the number of moves executed by steps D7D7 and D8D8 is 3n232n+938\frac{3n^{2}-32n+93}{8} when nn is odd. Number of moves executed by step D9D9 is 1. Therefore, the total number of moves executed by Algorithm LRE1LRE1 is

J(n)=2n8+3n240n+1498+2n5+3n232n+938+1=3n220n+734\begin{split}J^{\prime}(n)&=2n-8+\frac{3n^{2}-40n+149}{8}+2n-5+\frac{3n^{2}-32n+93}{8}+1\\ &=\frac{3n^{2}-20n+73}{4}\end{split}

Therefore, ignoring the lower order terms the new tighter upper bound for number of moves required to sort RnR_{n} with LRELRE is 3n24\frac{3n^{2}}{4}. ∎

IV Exhaustive Search Results

A branch and bound algorithm that employs BFS, i.e. Algorithm Search, has been designed for computing the minimum number of moves to sort RnR_{n} for a given nn. It yielded values of 43 for n=10n=10 and 53 for n=11n=11. Thus, including the current values, the identified minimum number of moves for for n=111n=1\ldots 11 are respectively (0,1,2,4,8,13,19,26,34,43,53)(0,1,2,4,8,13,19,26,34,43,53). A list of permutations whose distance has been computed is maintained and the execution in every branch terminates either upon reaching InI_{n} or exceeding a bound. E, L and R generators are applied to each of the intermediate permutations yielding the corresponding permutations. We avoid application of two successive generators that are inverses of each other as such a sequence cannot be a part of optimum solution. Notation: Node contains a permutation Sn\in S_{n} and its distance from RnR_{n} corresponds to the minimum number of moves. With this algorithm and better computational resources one will be able to compute the corresponding values for larger values of nn.

Algorithm Search
Initialization: The source vertex δ\delta contains the permutation RnR_{n} and its path is initialized to null. It is enqueued into BFS queue QQ.
Input:RnR_{n}. Output: Optimum number of moves to reach InI_{n} with LRELRE.

1:  while (Q is not empty) do
2:     Dequeue uu from QQ
3:     if (uu is visited) then
4:        continue
5:     end if
6:     Mark uu as visited
7:     if (uu is InI_{n}then
8:        {Array is sorted}
9:        return  length of u.pathu.path
10:        break
11:     end if
12:     if (Last move on u.pathu.path E\not=E or u.path=u.path= null ) then
13:        Execute E on uvu\rightarrow v
14:        if  vv is not visited then
15:           v.pathu.pathv.path\leftarrow u.path followed by E
16:           Enqueue vv to Q
17:        end if
18:     end if
19:     if (Last move on u.pathu.path L\not=L or u.path=u.path= null ) then
20:        Execute R on uvu\rightarrow v
21:        if  vv is not visited then
22:           v.pathu.pathv.path\leftarrow u.path followed by R
23:           Enqueue vv to Q
24:        end if
25:     end if
26:     if (Last move on u.pathu.path R\not=R or u.path=u.path= null ) then
27:        Execute L on uvu\rightarrow v
28:        if  vv is not visited then
29:           v.pathu.pathv.path\leftarrow u.path followed by L
30:           Enqueue vv to Q
31:        end if
32:     end if
33:  end while
Algorithm 3 Algorithm Search

V Results

Comparison of the number of moves required to sort RnR_{n} with LRELRE by various algorithms. The first column shows nn, the size of permutation. Subsequent columns show the number of moves required to sort RnR_{n} with Algorithms LRELRE, LRE1LRE1 and SearchSearch respectively.

n LRE LRE1 Search(Optimal)
3 3 2 2
4 4 4 4
5 8 8 8
6 15 13 13
7 25 20 19
8 38 26 26
9 54 34 34
10 73 43 43
11 95 54 53

Conclusion

The first known upper bound for sorting RnR_{n} with LRELRE has been shown. A tighter upper bound has been derived. The future work consists of identifying the exact upper bound for sorting RnR_{n} with LRELRE. The identification of the diameter of the LRELRE Cayley graph and the characterization of permutations that are farthest from InI_{n} in this Cayley graph are open questions.

Acknowledgement

Venkata Vyshnavi Ravella and CK Phani Datta have been contributing towards implementation, testing and analysis of the algorithms. Authors thank Jayakumar P for helpful suggestions. Authors thank Tony Bartoletti for personal communication.

References

  • [1] The On-Line Encyclopedia of Integer Sequences: oeis.org.
  • [2] Kuppili1 S. S., Chitturi1, B., and Srinath T., ”An Upper Bound for Sorting RnR_{n} with LE,” ICACDS 2019.
  • [3] Kuppili1 S. S., Chitturi1, B., ”Exact Upper Bound for Sorting RnR_{n} with LE,” “Discrete Math Algorithms Appl”. 2020, doi.org/10.1142/S1793830920500330.
  • [4] Akers, S. B., Krishnamurthy, B., ”A group-theoretic model for symmetric interconnection networks,” IEEE Transactions on Computers, 38(4):555–566, 1989.
  • [5] Lakshmivarahan, S., Jho, J-S., and Dhall, S. K., ”Symmetry in interconnection networks based on Cayley graphs of permutation groups: A survey,” Parallel Computing, 19:361–407, 1993.
  • [6] Chitturi, B., ”A note on complexity of genetic mutations,” Discrete Mathematics, Algorithms and Applications, 3, 269-286, 2011.
  • [7] Chitturi,B., and Das, P., ”Sorting permutations with transpositions in O(n3)O(n^{3}) amortized time,” Theoretical Computer Science, 2018.
  • [8] Biniaz, A., Jain, K., Lubiw, A., Masárová Z., Miltzow, T., Mondal, D., Naredla, A.M., Tkadlec, J., and Turcotte, A., ”Token Swapping on Trees,” http://arxiv.org/abs/1903.06981, 2019.
  • [9] Chitturi, B., Fahle, W., Meng, Z., Morales, L., Shields, C. O., Sudborough H., ”An (18/11) n upper bound for sorting by prefix reversals,” Theoretical Computer Science, 410(36): 3372-3390, 2009.
  • [10] Chitturi, B., Computing cardinalities of subsets of SnS_{n} with k adjacencies, JCMCC, (to appear) 2020.
  • [11] Erskine, G., and James T., ”Large Cayley graphs of small diameter,” Discrete Applied Mathematics, 2018.
  • [12] Feng, X., Chitturi,B., Sudborough, H., ”Sorting circular permutations by bounded transpositions,”, Advances in Computational Biology, Springer, New York, NY (2010), pp. 725-736.
  • [13] Gostevsky, D.A. and Konstantinova, E.V., ”Greedy cycles in the star graphs,” Discrete mathematics and mathematical cybernetics, 15(0):205-213, 2018.
  • [14] Jerrum, M. R., ”The complexity of finding minimum-length generator sequences,” Theoretical Computer Science, 36:265-289, 1985.
  • [15] Mokhtar, H., ”A few families of Cayley graphs and their efficiency as communication networks,” Bulletin of the Australian Mathematical Society, 95, no. 3, 518-520, 2017.
  • [16] Zhang, T., and Gennian G., ”Improved lower bounds on the degree–diameter problem,” Journal of Algebraic Combinatorics, 1-12, 2018.