Sitelet https://github.com/sananth12/algorithms/tree/master/Sorting
Skip to content

Latest commit

 

History

History

Sorting

  • Bubble Sort
  • Insertion Sort
  • Merge Sort
  • Quick Sort
  • Heap Sort
  • Counting Sort
  • Radix Sort

###Running time

I've included a file 'data', generated by the python script test_gen.py which contains 50000 random numbers. Then I did this:

$ g++ _some_Sort.cpp -o a
$ time ./a < data > out
$ real 0m0.xyzs
  user 0m0.xyzs
  sys  0m0.xyzs	

Where user+sys gives us the CPU time the process used, and real gives the wall clock time,from start to finish. This is not the worst case.The performance might vary for a different test case for heap,merge and quick sort. This is what I got for sorting 50,000 numbers.

Algorithm Time
Bubble Sort: 14.199s
Insertion Sort 7.159s
Heap Sort 0.085s
Merge Sort 0.080s
Radix Sort 0.077s
Quick Sort 0.069s
Counting Sort 0.060s