Write a program to sort numbers using the Bubble Sort algorithm.
- Bubble Sort
- Wrapper class
Create a program that uses the Bubble Sort technique to sort an ArrayList of integers. The program should include the following.
See https://www.geeksforgeeks.org/bubble-sort/ for a more detailed explanation of the Bubble Sort algorithm.
Main Program. Your program should:
- Create an ArrayList of 20 random integers from 1 to 100.
- Print the original, unordered array.
- Sorts the array of integers using the Bubble sort technique.
- Print the ArrayList during each major iteration of sorting to see how the sorting works, i.e. after each iteration of your main outer for loop (for i), not the inner loops (j and k).
- Print the final sorted ArrayList.
Bill Barnum’s AP Computer Science A test prep videos