Class QuickSort

java.lang.Object
com.collection.arraylist.QuickSort

public class QuickSort extends Object
This class provides a static method for performing a quicksort algorithm on a CustomArrayList containing elements that implement the Comparable interface.
  • Constructor Details

    • QuickSort

      public QuickSort()
  • Method Details

    • sort

      public static <T> void sort(CustomArrayList<T> arrayList, Comparator<T> comparator)
      Method to sort the elements in the given CustomArrayList using the Quick Sort algorithm. It starts the method quickSort(CustomArrayList<T> arrayList, int low, int high, Comparator<? super T> comparator) and launches the quick sort algorithm.
      Type Parameters:
      T - the type of elements that this QuickSort class can sort
      Parameters:
      arrayList - the CustomArrayList to be sorted
      comparator - the comparator to determine the order of the elements
    • sort

      public static <T extends Comparable<T>> void sort(CustomArrayList<T> arr)
      Sorts the elements in the given CustomArrayList using the quicksort algorithm. It starts the method quicksort(CustomArrayList<T> arr, int low, int high) and launches the quick sort algorithm.
      Type Parameters:
      T - the type of elements in the CustomArrayList, must implement Comparable interface
      Parameters:
      arr - the CustomArrayList to be sorted