Question: public class A07 { // logic to sort the elements public static void bubbleSort(int array[]) { } private static void swap(int i, int j, int[]
public class A07 { // logic to sort the elements public static void bubbleSort(int array[]) { } private static void swap(int i, int j, int[] array) { int temp; temp = array[i]; array[i] = array[j]; array[j] = temp; } private static void printArray(int[] input) { for (int i = 0; i
2) The sort must be a bubble sort. 3) Print out the initial array (already provided)
. 4) Identify the number of the current pass (iteration) through the array.
5) Print out the intermediate result of each pass (print routine already provided).
6) End the program when the array is completely sorted.

Initial Array: 4 2 9 6 23 12 34 0 1 Intermediate Steps: pass: 1 2 4 6 9 12 23 0 1 34 pass: 2 2 4 6 9 12 0 1 23 34 pass: 3 2 4 6 9 0 1 12 23 34 pass: 4 2 4 6 0 1 9 12 23 34 pass: 5 24 16 9 12 23 34 pass: 6 2 0 1 4 6 9 12 23 34 pass: 7 0 1 2 4 6 9 12 23 34 pass: 8 0 1 2 4 6 9 12 23 34 pass: 9 0 1 2 4 6 9 12 23 34 pass: 10 0 1 2 4 6 9 12 23 34 Sorted Array: 0 1 2 4 6 9 12 23 34 Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
