Search This Blog

Friday, September 25, 2015

Comparison of Sorting Algorithms Based on Execution Time

Last weekend I tried implementing various Sorting algorithms, and compared there outputs.

I ensured fair comparison of these algorithms by using same data for sorting -
1. I generated 10,000 Random numbers between from 0 to 50,000
2. Wrote output of above to a text file.
3. I used this text file as input test various sorting algorithms

Following table shows the comparison of these algorithms based on time required for sorting (it does not include time required to read and write input/ output)


Algorithm Time (in Milisecond)
Radix Sort Array Based Implementation 
*(Implemented for 5 digit numbers)
0.63
Counting Sort 
*(Implemented for numbers between 0 to 50,000)
0.792
Merge Sort
2.214
Quick Sort Non Recursive
2.266
Quick Sort Recursive
2.267
Heap Sort
3.416
Radix Sort Linked List Based Implementation  
*(Implemented for 5 digit numbers)
4.844
Insertion Sort
68.991
Shell Sort
96.15
Selection Sort
125.29
Bubble Sort 239.601


Programming Language used - C
Compiler - GCC (gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04))



No comments:

Post a Comment