In JAVA code (Insertion Sort): 1. Prepare a data set containing 10,000 integers (random). 2. Make a code that will create 3 variants of the data: one in best case (data are arranged in ascending order); the other in worst case (data are arranged in descending order); and the last in average case (data are randomly arranged). 3. Each integer is considered as one input in the code. 4. The output of your program should be the number of statements executed in the process of sorting for each of the algorithms. This, therefore, means that you have to embed a counter variable in your program that keeps track of the number of statements executed in the sorting part of your code. 5. The end value of the variable shall be the output of your program. Below is a sample of the code in Bubble Sort; I am asking for the program for insertion sort.
In JAVA code (Insertion Sort):
1. Prepare a data set containing 10,000 integers (random).
2. Make a code that will create 3 variants of the data: one in best case (data are arranged in ascending order); the other in worst case (data are arranged in descending order); and the last in average case (data are randomly arranged).
3. Each integer is considered as one input in the code.
4. The output of your program should be the number of statements executed in the process of sorting for each of the
5. The end value of the variable shall be the output of your program.
Below is a sample of the code in Bubble Sort; I am asking for the program for insertion sort.
Step by step
Solved in 3 steps with 1 images