Question: This program measures the approximate runtimes it takes for various sorting algorithms to sort arrays of random integers and floating point values. Repeat/modify the code

This program measures the approximate runtimes it takes for various sorting algorithms to sort arrays of random integers and floating point values. Repeat/modify the code below for the same array sizes but this time the contents of the array (array type) would be doubles. The functions to generate random doubles has already been written. Also, pointers to a double, dArray?, are declared for use in allocating the arrays of doubles. By the way, this code is intended for debugging, in each case a random array of size 50 is generated and the original and sorted arrays are printed.

#include #include #include #include #include "ArrayUtil.cpp" #include "SortUtil.cpp"

using namespace std; using namespace std::chrono;

int main(int argc, char **argv) { int *iArray1, *iArray2, *iArray3; double *dArray1, *dArray2, *dArray3; long bTime, sTime, qTime; int size[] = {100, 500, 1000, 5000, 10000, 50000, 100000}; srand(time(NULL)); int *testArray = new int[50]; cout<<"***Testing Selection Sort***"<

cout<<"***Testing Quick Sort***"<(elapsed).count();

start = high_resolution_clock::now(); SortUtil::bubbleSort(iArray2,size[i]); elapsed = high_resolution_clock::now() - start; bTime = duration_cast(elapsed).count();

start = high_resolution_clock::now(); SortUtil::quickSort(iArray3,0,size[i]-1); elapsed = high_resolution_clock::now() - start; qTime = duration_cast(elapsed).count(); cout<

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!