subject

Fill in the code to complete the following method for sorting a list.

public static void sort(double[] list) {
;
}

public static void sort(double[] list, int high) {
if (high > 1) {
// find the largest number and its index
int indexofmax = 0;
double max = list[0];
for (int i = 1; i < = high; i++) {
if (list[i]> max) {
max = list[i]; indexofmax = i;
}
}

// swap the largest with the last number in the list
list[indexofmax] = list[high];
list[high] = max;

// sort the remaining list
sort(list, high - 1);
}
}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 11:10
The total cost of textbooks for the term was collected from 36 students. create a histogram for this data. $140 $160 $160 $165 $180 $220 $235 $240 $250 $260 $280 $285 $285 $285 $290 $300 $300 $305 $310 $310 $315 $315 $320 $320 $330 $340 $345 $350 $355 $360 $360 $380 $395 $420 $460 $460
Answers: 2
question
Computers and Technology, 22.06.2019 17:00
Which of the following is not contained on the slide show toolbar? a. next button b. slide button c. close button d. pen tool
Answers: 1
question
Computers and Technology, 24.06.2019 12:30
Select all that apply. what two keys listed below should you use to enter data in an excel worksheet? tab backspace enter right arrow
Answers: 2
question
Computers and Technology, 24.06.2019 18:00
Your computer running windows 10 is doing some very strange things with the operating system. you are fairly certain it is not a hardware issue. you need to try to get further insight into what is going on within the operating system. which tool would be best-suited for this?
Answers: 1
You know the right answer?
Fill in the code to complete the following method for sorting a list.

public static void...
Questions
question
English, 19.04.2021 16:40
question
Mathematics, 19.04.2021 16:40