Class QuickSort


  • public abstract class QuickSort
    extends java.lang.Object
    This is a generic version of C.A.R Hoare's Quick Sort algorithm. This will handle arrays that are already sorted, and arrays with duplicate keys.

    • Constructor Summary

      Constructors 
      Constructor Description
      QuickSort()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void sort​(Sortable a, int lo0, int hi0)
      This is a generic version of C.A.R Hoare's Quick Sort algorithm.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • QuickSort

        public QuickSort()
    • Method Detail

      • sort

        public static void sort​(Sortable a,
                                int lo0,
                                int hi0)
        This is a generic version of C.A.R Hoare's Quick Sort algorithm. This will handle arrays that are already sorted, and arrays with duplicate keys.
        If you think of a one dimensional array as going from the lowest index on the left to the highest index on the right then the parameters to this function are lowest index or left and highest index or right. The first time you call this function it will be with the parameters 0, a.length - 1.
        Parameters:
        a - a Sortable object
        lo0 - index of first element (initially typically 0)
        hi0 - index of last element (initially typically length-1)