Practice: Sorting

Take out a piece of paper. We’ll be programming on paper.

Problem 1

In your teams write a generic Java class ArraySorter<E> that has one method:

public void insertionSort(E[] data, Comparator<E> c);

Remember Comparator is the following interface.

public interface Comparator<E> {
  int compare(E o1, E o2);
}

The insertionSort method must use the insertion sort algorithm to sort the data array.

Problem 2

Answer the following questions:

Show me your code before you leave