Question: program language c++ Write a program to implement problem statement below; provide the menu for input N and number of experiment M to calculate average
Write a program to implement problem statement below; provide the menu for input N and number of experiment M to calculate average time on M runs. randomly generated list. State your estimate on the BigO number of your algorithm/program logic. (we discussed in the class) Measure the performance of your program by given different N with randomly generated list with multiple experiment of Ns against time to draw the BigO graph (using excel) we discussed during the lecture (reference from week03-04.pdf in module 3).
"Given a value n>=1 and a list containing exactly n unique numbers called A1, A2, ..., Am.,
find and print out both the smallest value in the list and the position in the list where
the smallest value occurred"
*** high level of algorithm for measurement,
Step1. Given N>0, M >0, Input N, M, set C=M
Step2. While C is greater than 0, repeat Step 3 to 8
Step3. record start time
Step4. Fill the Array[N] with random number
Step5. call smallest(Array[N] return the smallest number and position
Step6. record end time
Step7. decrement C
Step8, running time[C] = end time - start time
Step9, Calculate average running time based on running time[M]
Step10. Record N and average running time into 2D Array


Part 1. Small, Smaller, Smallest Write a program to implement problem statement below; provide the menu for input N and number of experiment M to calculate average time on M runs. randomly generated list. State your estimate on the Bigo number of your algorithm/program logic. (we discussed in the class) Measure the performance of your program by given different N with randomly generated list with multiple experiment of Ns against time to draw the Bigo graph (using excel) we discussed during the lecture (reference from week03- 04.pdf in module 3). "Given a value n>=1 and a list containing exactlyn unique numbers called A1, A2, ..., Am., find and print out both the smallest value in the list and the position in the list where the smallest value occurred" *** high level of algorithm for measurement, Step1. Given N>0, M >0, Input N, M, set C=M Step2. While C is greater than 0, repeat Step 3 to 8 Step3. record start time Step4. Fill the Array[N] with random number Step5. call smallest(Array[N] return the smallest number and position Step6. record end time Step7. decrement C Step8, running time[C] = end time - start time Step9, Calculate average running time based on running time[M] Step10. Record N and average running time into 2D Array FIGURE 3.11 n2 5 4 3 Work 2. 1 n 0 0 T 1 2 T 4 T 6 3 un 5 LA A comparison of n and n
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
