Question
1. (20 pts) Given a bubble sort and the following array: [10,7,19,5,16] What are the values after the first iteration? 2. (20 pts) Given an
1. (20 pts) Given a bubble sort and the following array:
[10,7,19,5,16]
What are the values after the first iteration?
2. (20 pts) Given an insertion sort and the following array:
[50,5,35,70,6]
What does the array look like after the first insertion:
3. (20 pts) Fill in the missing code for InsertionSort method
// Insertion Sort method
//sorts an array of Auto objects
public static void insertionSort(Auto [] arr)
{
Auto temp;
int j;
for (int i=1; i { j=i; temp=arr[i]; while (j!=0 &&(temp.getModel().compareTo(arr[[j-1].getModel())<0) { arr[j] = arr[j-1]; j--; }//end while arr[j] = // your code goes here; }//end for loop }//end method 4. (40 pts) Write the code for doing a selection sort on an array; test your code and show a screenshot of it working you must output values of an array before and after the selection sort to prove it is working. The array must have at least 5 values.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started