Comparing Four important sorting algorithms based on their time complexity

Document Type

Conference Proceeding

Publication Date



Department of Computer Science


Time complexity and memory complexity are significant for all algorithms, especially sorting algorithms. Using the right sorting algorithm for our data can possibly decrease time and memory usage. The sorting problem has attracted a great deal of attention because efficient sorting is essential to optimize other algorithms as well. Most of the time, a sorting algorithm consists of two nested loops, which can determine the complexity of the algorithm; however, other factors such as the number of data and data types play an important role as well. Thus, by using the right sorting algorithm, we can make more efficient use of time and memory. In this paper, we use different sorting algorithms for different data types in order to determine the optimum use of time and memory for these algorithms. It means that if we know what kind of dataset we have, it can help us to use a more efficient algorithm even close to linear time. One of the interesting results is shell sort. So, by checking each type of data, like primes, Fibonacci, odd, and even datasets, we can know more information about each sorting algorithm. Also, we can determine which algorithm needs additional memory for sorting and which does not. To reduce the time and memory allocation, we use various data, such as numbers in random order or reverse order, as well as a large number of data and a small number of data. By comparing the results, the optimal algorithm in various scenarios may be recognized.

Publication Title

ACAI 2019: Proceedings of the 2019 2nd International Conference on Algorithms, Computing and Artificial Intelligence