New Permutation Generation Under Exchange Strategy (PGuES)

An exchange based technique for generating permutation is presented in this paper. This strategy involved exchanging two consecutive elements, to generate the starter sets. For list all permutations, the exchange and reversing operations will be employed on these starter sets. The numerical result shows that new method is better than other existing methods

Generating starter sets and exploited them for listing all permutation proposed by Ibrahim et al. (2010) in which they introduced a new permutation technique based on distinct starter sets by employing circular and reversing circular operation.The crucial task of Ibrahim et al. (2010) method was generating the distinct starter sets and eliminating the equivalence starter sets.Karim et al. (2011aKarim et al. ( , 2011b) ) proposed new operation strategies for generating distinct starter sets without generating the equivalence starter sets based on circular operation.Because the strategy of generating starter sets that is not unique, a new operation strategy namely exchange two (Karim et al., 2011b) proposed.At the end, all !n distinct permutations is listed also under circular and reversing circular operation.In this paper, we generate the starter sets under exchange operation and for listing down all permutation, we employ exchange and reversing exchange operation.

Some Definitions
The following definitions will be used throughout this study.

Definition 2.1 Starter set, S is a basis to enumerate other permutations.
Definition 2.2 An equivalence starter set is a set that can produce the same permutation from other starter set.Definition 2.3 A Latin square of order n is an n×n array in which n distinct symbols are arranged where each element occurs once in each row and column.

Definition 2.4
The circular permutation of order n (CP) is a Latin square of order n which is obtained by employing the circular permutation operation over all elements.
Definition 2.5 The reverse of circular permutation (RoCP) is also a Latin square of order n which is obtained by reversing arrangement element in each row of circular permutation.

Definition 2.6
The exchange operation is a permutation that interchanges two integers k and l, k≠l , but leaves all other integers fixed.

Definition 2.7
The reverse set is a set that is produced by reversing the order of permutation set.

Definition 2.8
The exchange permutation of order n (EP) is an n×n array in which element in first position only are exchange to the right.Definition 2.9 The reverse of exchange permutation (RoEP) is an n×n array which is obtained by reversing arrangement element in each row of exchange permutation.

Algorithm Development for Permutation
The development of new algorithm is divided into two stages.The first stage is starter sets generation while the second stage is permutation generation by exploiting the results in the first stage.The methods to generate (n-1)!/2 starter sets are based on exchange operations.For listing all !n distinct permutations, the EP and RoEP operations will be employed.Thus it would be worthwhile to see the advantages of this operation in term of time computation.

Starter Sets Generation Under Exchange Based
Let S be the set of n elements such that S = [1,2,…,n].Cases n = 2 and 3 are trivial.In this section, we illustrate how the algorithm works for cases n = 4 and n = 5 where it was generated recursively.The step by step of starter sets derivation is demonstrated for n = 4 and n = 5 as follows.
Step 1: Let [1,2,3,4] be an initial permutation and without loss of generality, the first element is fixed.
Step 2: Select element in the (n-2)th position i.e. element '2'.This element is exchange until it occupies the nth position.The three distinct starter sets are produces as follows: Next, we shall illustrate the second strategy for n = 5.

Permutation Generation Under Exchange and Reversing Operation
In this section, we demonstrate how n! distinct permutations are listed by performing of EP (column A) and RoEP (column B) to each starter sets (see Figures 4 and 5 ).
Case n = 4.As can be observed from Figures 4 and 5, there no redundancy permutation occurs when the starter sets are exploited for generating all permutations by employing EP and RoEP operations.
Remark 3.1 The bold permutation in Column A represents the starter sets.

Exchange Algorithm
Let define the algorithm for exchange operation strategy as a PGuES which is a recursion algorithm with only one recursive call.The integer n be an initial inputs, and temp = n-1 is an initial rank of the algorithm PGuES.At each stage of recursion, a rank for procedure PGuES is reduced from n-1 to 2 where each recursion call updates the entries in the storage.The general algorithm for permutation generation by employing EP and RoEP operation on starter sets which was generated from the exchange operation is as follows: The comparison among our methods for permutation generation is presented in the following section.

Differences Among Our Methods
The two algorithms were published namely PERMUT1 and PERMUT2.The PERMUT1 and PERMUT2 are an algorithm where starter sets was generated by circular operation and exchange operation respectively.Then for listing all permutation, both algorithms employed CP and RoCP operations on their starter sets.Given the example for n = 4.  1,3,2,4], [1,3,4,2] Next is example of listing 4! permutation for PERMUT1 and PERMUT2 algorithms.From Table 1, the starter sets for PERMUT2 and PGuESS are similar.However as can be observed from Figures 4 and 7, for listing all permutation, PERMUT2 employed CP and RoCP meanwhile PGuES employed EP and RoEP.

Numerical Results
For permutation generation algorithm performance, firstly our algorithm is compared to our previous PERMUT1 and PERMUT2 algorithms.Then it will be compared to other permutation generation program namely Langdon (1967), andThongchiew (2007).All sequential algorithms are implemented in C language and tested on the HP Computer with Intel Xeon E5504 2.0 GHz processor and 4.00 GB Random Access Memory (RAM).The result is an execution time without printing statements.From Table 3, we observe that PGuES is faster than Langdon (1967) and Thongchiew (2007).From Figures 4, 5, 6 and 7, an advantage of our method is we able to list n!/2 permutations (Column B) by reversing of the first n!/2 permutations (Column A).

Conclusion
The central idea of our work for listing permutation is a starter sets generation.The a new strategy to generate the starter sets is presented under exchange operation.Then exchange strategy is exploited to generate all !n permutations using EP and RoEP operations.

Figure 2 .Figure 3 .
Figure 2. Starter sets from the exchange of the (n-2)th element

Figure
Figure 4. List of 4! permutations temp to n do performing exchanges operation to the element at temp-th position call PGuES(temp) end for

Table 1 .
Starter sets generation for n = 4

Table 2 .
The computation time between new algorithm based on starter sets (in seconds) Table2indicates that our new algorithm, PGuES is better than our previous PERMUT1 and PERMUT2.The following table shows the results of run times among new algorithm for permutation generation.