/**
  * Sorts list. See MergeSort
  *
  * @param list
  * @param temp
  * @param low
  * @param high
  */
 private static <E extends Comparable<? super E>> void sort(
     ArrayList<E> list, ArrayList<E> temp, int low, int high) {
   if (low < high) {
     int center = (low + high) / 2;
     sort(list, temp, low, center);
     sort(list, temp, center + 1, high);
     merge(list, temp, low, center + 1, high);
   }
 }
 /**
  * code for merge sort from class slides adapted for use with ArrayList perform a merge sort on
  * the data in
  *
  * @param c c != null, all elements of c are the same data type
  */
 private static <E extends Comparable<? super E>> void mergeSort(ArrayList<E> c) {
   ArrayList<E> temp = new ArrayList<E>();
   for (int x = 0; x < c.size(); x++) temp.add(null);
   sort(c, temp, 0, c.size() - 1);
 }