Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1). Create a Map that can hold student IDs and student names. Add 6 students to the map. Test your program and take screenshorts; 2).

1). Create a Map that can hold student IDs and student names. Add 6 students to the map. Test your program and take screenshorts;

2). What is the Big-O notation for the following code?

for(int i=n; i>=0; i--){

k = 1;

while(k<=1000){

k++;

j=1;

do{

j++;

}while(j<=n);

}

}

3). The following code for InsertionSort is given to us by the textbook. Trace the code step by step using the array

[55, 22, 77, 99, 66, 33, 11] on a piece of paper or using a Word document. If the code has errors, correct it and make it work.

public static void insertionSort(double[] list) {
for (int i = 1; i < list.length; i++) {
/** insert list[i] into a sorted sublist list[0..i-1] so that
list[0..i] is sorted. */
double currentElement = list[i];
int k;
for (k = i - 1; k >= 0 && list[k] > currentElement; k--) {
list[k + 1] = list[k];
}

// Insert the current element into list[k+1]
list[k + 1] = currentElement;
}

}

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

Time Series Databases New Ways To Store And Access Data

Authors: Ted Dunning, Ellen Friedman

1st Edition

1491914726, 978-1491914724

More Books

Students also viewed these Databases questions

Question

2. In what ways have your peers and your parents helped shape you?

Answered: 1 week ago