private void quicksort(Comparable[] items, int low, int high) {
        int i = low, j = high;
        // Get the pivot element from the middle of the list
        Comparable pivot = items[low + (high - low) / 2];

        // Divide into two lists
        while (i <= j) {
            while (items[i].compareTo(pivot) < 0) {
                i++;
            }

            while (items[j].compareTo(pivot) > 0) {
                j--;
            }

            if (i <= j) {
                exchange(items, i, j);
                i++;
                j--;
            }
        }
        // Recursion
        if (low < j) {
            quicksort(items, low, j);
        }
        if (i < high) {
            quicksort(items, i, high);
        }
    }