Question: Please help with this JAVA program... you will be writing code to generate test data and benchmark sorting algorithms on it . First, write a

Please help with this JAVA program...

you will be writing code to generate test data and benchmark sorting algorithms on it

. First, write a series of methods that generate test data that is non-uniform: Half the data is 0s, half 1s. For example, an input of length 8 might look like [0, 1, 1, 0, 0, 1, 0, 1].

~Half the data is 0s, half the remainder is 1s, half the reminder is 2s, half the reminder is 3s, and so forth. For example, an input of length 8 might look like [0, 0, 1, 3, 0, 1, 2, 0].

~Half the data is 0s, half random int values (can use nextInt() from Java's Random package). For example, an input of length 8 might look like [0, 138617093, 0, 54119567, 0, 0, 4968, -650736346].

Each of these three techniques should be implemented as a static method that takes a integer representing the size of a dataset, and returns an integer array containing that number of elements generated with the corresponding rule.

Randomize (shuffle) the contents of the array after you populate it. Using the three methods you implemented, develop and test hypotheses about the effect of input on the performance of two of the algorithms (SELECTION sort/ Insertion sort). See the course git repository for implementations.

as comments: describe what you think the running time will look like (O(n)? O(n2)? O(n3)?) on each data set.

For each of the two sorting algorithms, your program should run them on the three types of test data. Test them with datasets size of 2048 and 4096. Time each of these twelve tests(If your system is so fast you don't get good results, you may increase the dataset size.)

The program needs to compute the result of the doubling formula on the run times from the 2048 and 4096 result pairs to get the power (b) for that algorithm on that type of input, and then display it.

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!