All Packages  Class Hierarchy  This Package  Previous  Next  Index  
Class DataStructures.Sort
java.lang.Object
    |
    +----DataStructures.Sort
- public final class Sort
- extends Object
A class that contains several sorting routines,
implemented as static methods.
Arrays are rearranged with smallest item first,
using compares.
 
 Sort() Sort()
- 
 
 heapsort(Comparable[]) heapsort(Comparable[])
- Standard heapsort.
 insertionSort(Comparable[]) insertionSort(Comparable[])
- Simple insertion sort.
 mergeSort(Comparable[]) mergeSort(Comparable[])
- Mergesort algorithm.
 quickSelect(Comparable[], int) quickSelect(Comparable[], int)
- Quick selection algorithm.
 quicksort(Comparable[]) quicksort(Comparable[])
- Quicksort algorithm.
 shellsort(Comparable[]) shellsort(Comparable[])
- Shellsort, using a sequence suggested by Gonnet.
 swapReferences(Object[], int, int) swapReferences(Object[], int, int)
- Method to swap to elements in an array.
 
 Sort
Sort
public Sort()
 
 insertionSort
insertionSort
public static void insertionSort(Comparable[] a)
- Simple insertion sort.
 
- 
- Parameters:
- a - an array of Comparable items.
 
 shellsort
shellsort
public static void shellsort(Comparable[] a)
- Shellsort, using a sequence suggested by Gonnet.
 
- 
- Parameters:
- a - an array of Comparable items.
 
 heapsort
heapsort
public static void heapsort(Comparable[] a)
- Standard heapsort.
 
- 
- Parameters:
- a - an array of Comparable items.
 
 mergeSort
mergeSort
public static void mergeSort(Comparable[] a)
- Mergesort algorithm.
 
- 
- Parameters:
- a - an array of Comparable items.
 
 quicksort
quicksort
public static void quicksort(Comparable[] a)
- Quicksort algorithm.
 
- 
- Parameters:
- a - an array of Comparable items.
 
 swapReferences
swapReferences
public static void swapReferences(Object[] a,
                                  int index1,
                                  int index2)
- Method to swap to elements in an array.
 
- 
- Parameters:
- a - an array of objects.
- index1 - the index of the first object.
- index2 - the index of the second object.
 
 quickSelect
quickSelect
public static void quickSelect(Comparable[] a,
                               int k)
- Quick selection algorithm.
Places the kth smallest item in a[k-1].
 
- 
- Parameters:
- a - an array of Comparable items.
- k - the desired rank (1 is minimum) in the entire array.
 
All Packages  Class Hierarchy  This Package  Previous  Next  Index