public static double time(String alg, Comparable[] a) {
    Stopwatch timer = new Stopwatch();
    if (alg.equals("Insertion")) Insertion.sort(a);
    if (alg.equals("Selection")) Selection.sort(a);
    if (alg.equals("Shell")) Shell.sort(a);
    if (alg.equals("Merge")) Merge.sort(a);
    if (alg.equals("MergeWithImprovements")) MergeWithImprovements.sort(a);
    if (alg.equals("Quick")) Quick.sort(a);
    if (alg.equals("Heap")) Heap.sort(a);
    if (alg.equals("InsertionWithSentinel")) InsertionWithSentinel.sort(a);
    return timer.elapsedTime();
  }