Twin Sort In computer science, there are existed various sorting algorithms because all sorting methods has various sorting efficiencies depend on data structure. As one of the sorting algorithms, Twin Sort Algorithm enable to sort elements of a data structure effectively and simply by least comparing and iterating. Twin sorting is a iteration and comparison algorithm which was introduced by Veeresh Devireddy, Thimmaraju S. N, and Ravish G. K. on the International Journal of Combined Research & Development (IJCRD) in 2014. Algorithm Conceptually, the twin sort works in a data structure as follow: # From the unsorted input data (i.e. array or list), create iterations which are not equal to the number of elements divided by two. # The iterations will check every single elements in the data structure. # During each iteration, make pairs of elements and then swap elements in the pair if difference exists in the pair. # Through iterations, if the input data is in order, then finish the sorting process. * Example of the sorting process: With the twin sort, given the elements of an integer array will be sorted into ascending order Input integer array: 5, 4, 3, 2, 1 Paring elements 2 by 2: (5, 4) (3, 2), 1 The paired elements Swapped during Iteration 0: (5, 4) (3, 2), 1 → (4, 5) (2, 3), 1 The result after Iteration 0: 4, 5, 2, 3, 1 Iteration 1: 4, (5, 2) (3, 1) → 4, (2, 5) (1, 3) The result after Iteration 1: 4, 2, 5, 1, 3 Iteration 2: (4, 2) (5, 1), 3 → (2, 4) (1, 5), 3 The result after Iteration 2: 2, 4, 1, 5, 3 Iteration 3: 2, (4, 1) (5, 3) → 2, (1, 4) (3, 5) The result after Iteration 3: 2, 1, 4, 3, 5 Iteration 4: (2, 1) (4 3), 5 → (1, 2) (3, 4), 5 The result after Iteration 4: 1, 2, 3, 4, 5 Analysis of Efficiencies There are two algorithmic complexities to check how any sort algorithm is efficient: * Time Complexity * Space Complexity Time complexity is a computational estimation which describes how fast an given algorithm executes and the total amount of execution time. It is the memory required by an algorithm to execute a program and produce output. The Twin sort algorithm decreases the size of data structure elements to the half, so this decrease makes less the execution time for comparisons in each iteration. Space complexity is a necessary factor to check an algorithm's efficiency because it indicates that how much memory space is needed for calculating depend on the size of the user input. In related to the space complexity, Twin sort algorithm is not required extra memory space during sorting process because this algorithm utilizes the iteration technique which does not need the stack memory during compiling. This is a big difference between iteration based sorting and recursion based sorting algorithms (Quick sort and Merge sort). Most of all, pairing only two elements in a data structure and swapping process in the paired elements are powerful features to optimize the efficiency of this algorithm. * Best-case efficiency: For all n size of the input: C (n) = O (n-1) * Worst-case efficiency: For all n size of the input: C (n) = O ((n-1)*(n/2)) → O (n Log n) * Average case efficiency: For all n size of the input: C (n) = O ([(n-1)*(n/2)]/2) → O (n Log n) Scope and Life Algorithm can be defined as the process of problem solving. Most of all, algorithm is very important in the modern times because it is core of most technology which utilized in modern computer.. Especially, sorting algorithms can be utilized in various fields like computer science and engineering. There are some applications of Twin sort algorithm below: * To sort elements or names of data in Binary Search algorithm. * To record or tuple the order of table data structure like DBMS or Hash Table. * To make an order the files and directories in the operating systems like Windows, Linux, and MAC. * To sort data frames as the receiver side in the Graph Theory and the communication network. Note
|
|
|