Computers and Technology, 30.11.2021 22:30 eelebron0905
The bubble sort algorithm shown in this chapter is less efficient than it could be. If a pass is made through the list without ex- changing any elements, this means that the list is sorted and there is no reason to continue. Modify this algorithm so that it will stop as soon as it recognizes that the list is sorted. Do not use a break statement! Make it to where it compiles succesfully. Thanks
Program:
public class bubblesort
{
public static void bubbleSort (Comparable[] data, int maxlength)
{
int position, scan;
Comparable temp;
for (int i = maxlength-1; i >= 1; i--)
{
for (scan = 0; scan <= maxlength-i ; scan++)
{
if (data[scan].compareTo(data[scan+i]) > 0)
{
// Swap the values
temp = data[scan];
data[scan] = data[scan + i];
data[scan + i] = temp;
}
}
}
}
}
Answers: 3
Computers and Technology, 22.06.2019 10:40
When running anti-virus software , what could be a reason where recipitent is not guaranteed that data being streamed will not get interrupted?
Answers: 1
Computers and Technology, 23.06.2019 22:20
Learning sign language is an example of a(n) learning sign language is an example of a(n)
Answers: 2
Computers and Technology, 23.06.2019 23:30
Match the following errors with their definitions. a. #name b. #value c. #ref d. 1. when a formula produces output that is too lengthy to fit in the spreadsheet cell 2. when you enter an invalid cell reference in a formula 3. when you type text in cells that accept numeric data 4. when you type in a cell reference that doesn’t exist
Answers: 1
Computers and Technology, 24.06.2019 01:30
Could you find out how im still getting an 83 percent on this in edhesive a = input("enter an animal: ") s = input ("enter a sound: ") e = "e-i-e-i-o" print ("old macdonald had a farm, " + e) print ("and on his farm he had a " + a + "," + e) print ("with a " + s + "-" + s + " here and a " + s + "-" + s + " there") print ("here a " + s+ " there a " + s) print ("everywhere a " + s + "-" + s ) print ("old macdonald had a farm, " + e)
Answers: 2
The bubble sort algorithm shown in this chapter is less efficient than it could be. If a pass is mad...
Mathematics, 11.10.2019 02:00
Health, 11.10.2019 02:00
Mathematics, 11.10.2019 02:00
Law, 11.10.2019 02:00
Mathematics, 11.10.2019 02:00
Mathematics, 11.10.2019 02:00
History, 11.10.2019 02:00