Question: Program needs to be in C++ Should not require any user input Please create a program that generates a random array of 500, 1000, and
Program needs to be in C++
Should not require any user input
Please create a program that generates a random array of 500, 1000, and 2000 elements and then sorts each array using selection sort, merge sort, quick sort, and heap sort. Each sorting algorithm must begin with the same array. The program must also use the C++ system time method to gather time before and after the call and calculate how many milliseconds it took to complete the task.
The output will display:
array size = 500
time taken (in milliseconds) to sort using selection sort
time taken (in milliseconds) to sort using merge sort
time taken (in milliseconds) to sort using quick sort
time taken (in milliseconds) to sort using heap sort
array size = 1000,
time taken (in milliseconds) to sort using selection sort
time taken (in milliseconds) to sort using merge sort
time taken (in milliseconds) to sort using quick sort
time taken (in milliseconds) to sort using heap sort
array size = 2000
time taken (in milliseconds) to sort using selection sort
time taken (in milliseconds) to sort using merge sort
time taken (in milliseconds) to sort using quick sort
time taken (in milliseconds) to sort using heap sort
Please do not copy/paste code from other questions.
Please provide screenshot of output and complete code.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
