Recursive sorting

We will implement the quick sort with an extra class that is in the qsort package along with the partitioning class, which is as follows:

package; // imports deleted from the print public class Qsort<E>  { // constructor injected final fields deleted from the print     public void qsort(SortableCollection<E> sortable, int start, int end) {         if (start < end) {             final E pivot = sortable.get(start);             final Partitioner<E> partitioner = new Partitioner<>(comparator, swapper);             int cutIndex = partitioner.partition(sortable, start, end, pivot);             if (cutIndex == start) {                 cutIndex++;             }             qsort(sortable, start, cutIndex - 1);             qsort(sortable, cutIndex, end);         }     } }

The method gets SortableCollection<E> ...

Get Java 9 Programming By Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.