International Journal of Computer Applications |
Foundation of Computer Science (FCS), NY, USA |
Volume 175 - Number 28 |
Year of Publication: 2020 |
Authors: Adolf Fenyi, Michael Fosu, Bright Appiah |
10.5120/ijca2020920813 |
Adolf Fenyi, Michael Fosu, Bright Appiah . Comparative Analysis of Comparison and Non Comparison based Sorting Algorithms. International Journal of Computer Applications. 175, 28 ( Oct 2020), 22-25. DOI=10.5120/ijca2020920813
Sorting is one of the most important task in many computer applications. Efficiency becomes a big problem when the sorting involves a large amounts of data. There are a lot of sorting algorithms with different implementations. Some of them sort data by comparison while others don’t. The main aim of this thesis is to evaluate the comparison and non-comparison based algorithms in terms of execution time and memory consumption. Five main algorithms were selected for evaluation. Out of these five, three were comparison based algorithms (quick, bubble and merge) while the remaining two were non-comparison based (radix and counting). After conducting an experiment using array of different data sizes (ranging from 1000 to 35000), it was realized that the comparison based algorithms were less efficient than the non-comparison ones. Among the comparison algorithms, bubble sort had the highest time complexity due to the swapping nature of the algorithm. It never stops execution until the largest element is bubbled to the right of the array in every iteration. Despite this disadvantage, it was realized that it is memory efficient since it does not create new memory in every iteration. It relies on a single memory for the swapping array operation. The quick sort algorithm uses a reasonable amount of time to execute, but has a poor memory utilization due to the creation of numerous sub arrays to complete the sorting process. Among the comparison based algorithms, merge sort was far better than both quick and bubble. On the average, merge sort utilized 32.261 seconds to sort all the arrays used in the experiment while quick and bubble utilized 41.05 and 165.11 seconds respectively. The merge algorithm recorded an average memory consumption of 5.5MB for all the experiment while quick and bubble recorded 650.792MB and 4.54MB respectively. Even though the merge sort is better than both quick and bubble, it cannot be compared to the non-comparison based algorithms since they perform far better than the comparison based ones. When the two groups were evaluated against execution time, the comparison based algorithms recorded an average score of 476.757 seconds while the non-comparison obtained 17.849 seconds. With respect to the memory utilization, the non-comparison based algorithms obtained 27.12MB while the comparison ones obtained 1321.681MB. This clearly reveals the efficiency of the non-comparison based algorithms over the comparison ones in terms of execution time and memory utilization.