User:Drveresh/Twin Sort Technique

[INPROGRESS-PAGE!!]

Twin Sort Technique, the objective behind the “TWIN SORT” technique is to sort the list of unordered data elements efficiently and to allow efficient and simple arrangement of data elements within the data structure with optimization of comparisons and iterations in the sorting method. This sorting technique effectively terminates the iterations when there is no need of comparison if the elements are all sorted in between the iterations. Unlike Quick sort, Merge sorting technique, this new sorting technique is based on the iterative method of sorting elements within the data structure. So it will be advantageous for optimization of iterations when there is no need for sorting elements. Finally, the “TWIN SORT” technique is more efficient and simple method of arranging elements within a data structure and it is easy to implement when comparing to the other sorting technique. By the introduction of optimization of comparison and iterations, it will never allow the arranging task on the ordered elements.

Details

The Sorting is an important concept of programming. The sorting method allows different ways to arrange the given elements in a data structure. There are different sorting methods with their own best-case and worst-case efficiencies. But in almost all sorting techniques there are no optimizations for preventing and reducing the unnecessary comparisons or iterations. So in order to allow an effective and simple arrangement of elements with least number of comparisons and iterations within a data structure, the new iterative sorting technique "Twin Sort" is introduced.

This sorting technique possesses a good average case behavior with effective optimizations in comparisons and iterations during arranging the data elements. The basic terminology behind this sorting technique is the Twin or couple of elements. This algorithm works by considering (dividing) array elements as Twins of elements and the elements which comes in these Twins (every two elements) are sorted iteratively with existence of optimization in between the iterations i.e., here the optimization will terminate the sorting process if all the elements within these Twins are sorted within N iterations. Therefore here the way we are optimizing the iterations and its comparisons will lead to the excellent time and memory space efficiency.

In the “Twin Sort” method of sorting elements, over all tasks is divided according to the EVEN and ODD number of iterations. Because, for the purpose of swapping the Twin„s elements, the formation of Twins (consideration of multiple two elements) must be done at two particular starting positions they are at [0] th (first) position and [0+1] th (second) position in the array depending on the EVEN and ODD number of the iteration. Here we usually start the iterations with number from 0 to N-1 (i.e., we start the loop from 0 to N-1). If the iteration number is EVEN (say 0,2,4,6, etc) then we start forming a Twin of elements (considering two elements) sequentially starting at 0th position. Therefore the first Twin will be (array[0],array[1]), the second Twin will be (array[2],array[3]) and the third will be (array[4], array[5]) and so on. Similarly, if the iteration number is ODD (say 1,3,5,7, etc) then we start forming a Twin of elements (considering two elements) sequentially starting at [0+1] th i.e., at 2nd position, therefore the first Twin will be (array [1], array [2]) the second Twin will be (array [3], array [4]) and the third will be (array [5], array [6]) and so on. As and when we form the Twin elements, we swap the elements of the Twin, if there is difference between those two elements of the Twin, else we keep those Twin elements as it is in the array or data structure. In this case no swapping operation is done. During the determination of the TRUE or FALSE conditions of the differences of Twin elements, we then keep count of FALSE conditions, this count value will be used to terminate the sorting process and exit from it to optimize the further comparisons. Importantly, the sorting process is terminated when the Count of FALSE conditions is equal to the (N-1)‟ where N is the number of input elements.In this new sorting technique, all iteration needs exactly „N/2‟ comparisons, if there is ODD number of input elements i.e., if N is ODD number. Similarly, it needs 'N/2' comparisons in ith iteration and (N-1)/2 comparisons in (i-1)th iteration if there are EVEN number of elements i.e., if N is even.