Package dsa

Class Quick3way

java.lang.Object
dsa.Quick3way

public class Quick3way extends Object
This library implements quick-3-way sort.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    main(String[] args)
    Unit tests the library.
    static void
    sort(double[] a)
    Sorts the array a.
    static void
    sort(int[] a)
    Sorts the array a.
    static <T extends Comparable<T>>
    void
    sort(T[] a)
    Sorts the array a according to the natural order of its items.
    static <T> void
    sort(T[] a, Comparator<T> c)
    Sorts the array a according to the order induced by the comparator c.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • sort

      public static <T extends Comparable<T>> void sort(T[] a)
      Sorts the array a according to the natural order of its items.
      Type Parameters:
      T - the type of items in a.
      Parameters:
      a - the array to sort.
    • sort

      public static <T> void sort(T[] a, Comparator<T> c)
      Sorts the array a according to the order induced by the comparator c.
      Type Parameters:
      T - the type of items in a.
      Parameters:
      a - the array to sort.
      c - the comparator to determine the order of the array.
    • sort

      public static void sort(int[] a)
      Sorts the array a.
      Parameters:
      a - the array to sort.
    • sort

      public static void sort(double[] a)
      Sorts the array a.
      Parameters:
      a - the array to sort.
    • main

      public static void main(String[] args)
      Unit tests the library.
      Parameters:
      args - the command-line arguments.