Question: How to tackle this problem by using the sorting method in java? M A Lab09.pdf (2,2} v a number pattern that is needed here (1,2,
How to tackle this problem by using the "sorting" method in java?
M A Lab09.pdf (2,2} v a number pattern that is needed here (1,2, etc.). You can use a regular loop for this, with a variable that increments. Note that the array indexes must start at zero (0, 1, etc.) 2. Revise Sorting.java such that the "selectionSort" method prints a numbered list (starting at 1) showing the entire array after cach swap. Additionally, create an application class with an array of at least 6 items that prints the original array (using a loop) and then calls the new "selectionSort" method. Note that the application class (with the main method) does not print the array after the swaps. Below is an example using Strings. Be sure to submit both Java files (the application class and the modified Sorting.java) Original array: John Xiaoni Sarah Fanil Mark Laura Selection sort... 1. Fanil Xiaoni Sarah John Mark Laura 2. Fanil John Sarah Xiaoni Mark Laura 3. Fanil John Laura Xiaoni Mark Sarah 4. Fanil John Laura Mark Xiaoni Sarah 5. Fanil John Laura Mark Sarah Xiaoni Tip (what to change): The outer loop of the selectionSort method iterates once for every swap. So at the end of that loop, you can print the number (hint: notice that "index" goes 0, 1, etc.) followed by the array. Here you can use the convenient for-loop trick that was used in the tutorial Post quest 16 questc TUT
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
