We were given the starting point for the timing function to record the elapsed time for three sorting algorithms (Bubble, Insertion, Selection) and don't know how to proceed from here.
In this exercise use the program below (ClockTime.cpp) as a starting point for the timing function. Create a program (ch3SortTest.cpp) that will create an array of 10,000 random integers.
A. Sort the array with each of the simple sorting algorithms and record the elapsed time for each sorting algorithm and display the results.
B. Re-load the array with sequential numbers in ascending order and repeat step A.
C. Re-load the array with sequential numbers in descending order and repeat step A.
Your output should look like the screenshot below. Your timing values will vary based on the type of system you use for this test.
<random> is a little complicated because it has a lot of options, but you can use the example there ... it has everything you need for this program
its likely you get overflow?
100000 to the 5th is 10 to the 25th
this is way larger than unsigned 64 bit int (2 to the 19th roughly)
so you probably have an issue in this code... because i is using integer math, you may want to cast it as a double eg
log( (double)(i)*i*i*i*i) ;