Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems 22nd European Conference Adbis 2018 Budapest Hungary September 2 5 2018 Proceedings Lncs 11019

Authors: Andras Benczur ,Bernhard Thalheim ,Tomas Horvath

1st Edition

3319983970, 978-3319983974

More Books

Students also viewed these Databases questions

Question

Enhance your words with effective presentation aids

Answered: 1 week ago