Question: Write a program in C++ to do the following: Your program should perform the following: a. Randomly generate three integer arrays A1, A2, and A3

Write a program in C++ to do the following: Your program should perform the following:

a. Randomly generate three integer arrays A1, A2, and A3 of sizes N=103 , 105 , and 107 (or 106 , if your computer cannot handle an integer array of size 107 ), in that order.

b. Run the sorting algorithm QUICK SORT on each of the three arrays A1, A2 and A3, and record the number of comparisons between array elements and actual elapsed times in appropriate time units, for instance, milliseconds.

c. Repeat b on the sorted arrays A1, A2 and A3.

d. Reverse the order of the three arrays A1, A2 and A3 and repeat b once more.

So basically im asking for 3 codes 1 with the ramdom arrays of the specific sizes (1000,10000 and 10000000) another one with the arrays already ordered (increasing 1,2,3,4,....N) and another with the arrays in decreasing order (N...4,3,2,1) for QUICK SORT this is very important because the point of the exercise is to analyze the running times on best, average and worst case for the algorithm.

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!