I'm working on timing these 4 Sorting Algorithms:
1. Quick Sort
2. Merge Sort
3. Insertion Sort
4. Selection Sort
Is the order listed above the correct order for Quickest to Slowest?
My current output in my program is this:
Quick Sort 0.79 milliseconds
Merge Sort 1.81 milliseconds
Insertion Sort 0.01 milliseconds
Selection Sort 4.29 milliseconds
Here's the algorithm I'm using to figure it out.
1 2 3 4 5 6 7 8 9
// N is a const double = 100000
clock_t start = clock();
for(int i = 0; i < N; i++)
{
sort.quick_Sort();
}
clock_t end = clock();
clock_t diff= end - start;
cout<<"\nIt takes the Quick Sort "<<((diff/(N*CLOCKS_PER_SEC))*THOUSAND)<<" milliseconds.\n";