Question: Part I: Algorithm Selection and Implementation The following lab involves implementing sorting algorithms and perform bench-marking for the behavior of the sorting algorithm. Implement in

Part I: Algorithm Selection and Implementation The following lab involves implementing sorting algorithms and perform bench-marking for the behavior of the sorting algorithm. Implement in Java one of the following sorting algorithms: bubble sort, selection sort, insertion sort, shell sort, merge sort, quick sort, or heap sort The purpose is to write the code to perform the benchmarking of the algorithm of your selection. The program must include an iterative and a recursive version of the algorithm you chose. In addition, you should examine the result of each call to verify that the data has been properly sorted to verify the correctness of the algorithm, i.e., in case the array is not sorted, an exception should be thrown.

Part II: Data Generation Your program it should also randomly generate data to pass to the sorting methods. Generate data evenly spaced so this data can be used to generate information including graphs, charts and other visualization items. It should produce 50 data sets for each value of n, the size of the data set and average the result of those 50 runs. The exact same data must be used for the iterative and the recursive algorithms. It should also create 10 different sizes of data sets. Choose sizes that will clearly demonstrate the trend as n becomes large.

Part III: Testing and Benchmarking You must identify some critical operations (depending on your algorithm of choice) that reflects the overall performance and modify each version so that it counts that operation. To count a critical operations you must measure the actual run time in nanoseconds1 . 1Please see System.nanoTime() for mode details

Part IV: Output and Report The output files should contain 10 lines that correspond to the 10 data set sizes. The first value on each line should be the data set size followed by 50 pairs of values. Each pair represents the critical element count and the time in nanoseconds for each of the 50 runs of that data set size. Create a file called results.txt that will contain the following table: the first column should contain the data set size the second the average of the critical counts for the 50 runs the third the coefficient of variance of those 50 values expressed as a percentage. the fourth and fifth column should contain similar data for the times. The coefficient of variance of the critical operation counts and time measurement for the 50 runs of each data set size provide a way to gauge the data sensitivity of the algorithm. Size Avg Count Coef Count Avg Time Coef Time 100 2400.01 6.71% 3582.00 60.19% 200 9791.55 4.56% 10500.00 17.72% 300 22188.18 3.97% 22674.00 27.94% 400 39566.42 2.78% 37936.00 16.40% 500 61769.74 2.76% 54624.00 14.25% 600 88523.30 2.45% 78360.00 18.74% 700 122056.28 2.06% 106868.00 18.90% 800 158845.62 2.21% 140978.00 20.06% 900 200274.56 2.40% 181874.00 26.50% 10000 247357.42 2.37% 205138.00 21.26%

Annex A: Coefficient of Variation In probability and statistics, the Coefficient of Variation (CV) is used to measure the dispersion of a probability distribution. In computing, helps us how an algorithm performs in a machine after several executions. The CV is determined with the following formula: CV = where: : standard deviation : is the mean of the data a.k.a., average Reminder: The standard deviation can be calculated as follows: = r (xi ) 2 N

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!