A Comparative Study of Sorting Algorithms Based on Time Complexity and Runtime
This study presents a comparative performance analysis of six fundamental sorting algorithms: Bubble Sort, Selection Sort, Insertion Sort, Merge Sort, Quick Sort, and Heap Sort. The algorithms were implemented in Python and evaluated using different input sizes ranging from 1,000 to 20,000 elements. Three types of datasets were considered: random, already sorted, and reverse-sorted data. Execution time was measured using Python's time.perf_counter() function, and the average runtime was calculated over three trials. The experimental results demonstrate how theoretical time complexity relates to practical execution performance. Quick Sort performed particularly well on random datasets but experienced significant slowdown on sorted and reverse-sorted inputs due to its fixed pivot selection. Insertion Sort performed efficiently on already sorted datasets. The study highlights the importance of input characteristics when selecting an appropriate sorting algorithm.
Authors
- Ayush
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2026-11-15
- DOI
- https://doi.org/10.5281/zenodo.24244560
- Primary Topic
- Algorithms and Data Compression
- Type
- preprint