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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started