Question: use java pls, as easy as possible Write a program that counts the number of basic steps needed for sorting an array of integer numbers.

use java pls, as easy as possible

Write a program that counts the number of basic steps needed for sorting an array of integer numbers. Implement the Selection Sort algorithm, and the Insertion Sort algorithm (and as a challenge: the BubbleSort algorithm). Use the following methods: public static void insertion sort(int array[]) and public static void selection sort(int array[]). Challenge: public static void bubble sort(int array[]). Each method sorts the array given as a parameter. It also counts and prints the number of comparison steps and the number of swap operations needed. You may re-use your code from the previous lab.

In the main method, test and compare each algorithm with the following inputs: an array of random numbers as input (use the same array for both algorithms!) (You can use the following numbers: 4, 2, 9, 6, 23, 12, 34, 0, 1, 76 or create your own, big array with 1,000 elements or more) an array that is already sorted an array that is sorted in reverse order.

Remember this: an array gets changed inside of a method. So, make a copy of the original array and use the copy as an argument for each sorting method. Each method needs its own copy. Submit your program and your comparison results (as online text below) for input cases 1, 2, and 3.

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!