Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In a class named UsernameA09, write these two static sort methods: public static

ID: 3655619 • Letter: I

Question

In a class named UsernameA09, write these two static sort methods: public static > void insertionSort(List list) public static > void mergeSort(List list)

Explanation / Answer

package com.cramster.nov8; import java.util.Arrays; import java.util.Collections; import java.util.LinkedList; import java.util.List; import java.util.Random; public class UsernameA09 { //This code will be a lot simpler if you can specify the type og objects //Stored in List public static void insertionSort(List list) { for(int i=list.size() - 1; i >= 0; i--) { Object temp = Collections.max(list.subList(0, i + 1)); for(int j = 0; j = 1) { int middle1 = (start + end)/2; sort(start,middle1,list); sort(middle1+1,end,list); merge(start,middle1,end,list); } } public static void merge(int start,int middle1,int end,List list) { int combinedIndex = start; int left = start; int right = middle1+1; while(left = right) { if(list.get(left)