[Solved]Modify Insertionsort Algorithm Sorts Descending Order Rather Ascending Order Public Static Q37149840
Modify the insertionSort algorithm so that it sorts indescending order rather than ascending order.
public static void insertionSort(Comparable[] list)
{
for (int index = 1; index <list.length; index++)
{
Comparable key =list[index];
int position =index;
// Shift largervalues to the right
while (position> 0 && key.compareTo(list[position – 1]) < 0)
{
list[position] = list[position – 1];
position–;
}
list[position] =key;
}
}
Expert Answer
Answer to Modify the insertionSort algorithm so that it sorts in descending order rather than ascending order. public static void … . . .
OR

