private int partition(List<T> list, int left, int right) {
        int pivot = selectPivot(list, left, right);
        T pivotValue = list.get(pivot);
        list.set(pivot, list.get(right));
        list.set(right, pivotValue);

        int smallerStore = left;
        for ( int i = left ; i < right  ;  i  ++ ) {
            T target = list.get(i);
            boolean requireSwap = target.compareTo(pivotValue) <= 0;
            if ( requireSwap ) {
                list.set(i, list.get(smallerStore));
                list.set(smallerStore, target);
                smallerStore ++;
            }
        }

        list.set(right, list.get(smallerStore));
        list.set(smallerStore, pivotValue);

        return smallerStore;
    }