Question: part 1 The following involves implementing sorting algorithms and perform bench-marking for the behavior of the sorting algorithm. Implement in Java one of the following
part 1 The following 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 .
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.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
