datastructures

net.datastructures
Class Sort

java.lang.Object
  extended bynet.datastructures.Sort

public class Sort
extends Object

Class containing various sorting algorithms.

Author:
Michael Goodrich, Roberto Tamassia, Eric Zamore

Constructor Summary
Sort()
           
 
Method Summary
static void main(String[] argv)
           
static void merge(List L1, List L2, Comparator c, List L)
          Merge two sorted lists, L1 and L2, into a sorted list L.
protected static void merge(Object[] in, Object[] out, Comparator c, int start, int inc)
           
static void mergeSort(List L, Comparator c)
          Sort the elements of list L in nondecreasing order according to comparator c, using the merge-sort algorithm.
static void mergeSort(Object[] orig, Comparator c)
          Sort an array of objects with a comparator using nonrecursive merge sort.
static void quickSort(List L, Comparator c)
          Sort the elements of list L in nondecreasing order according to comparator c, using a list-based implementation of the quicksort algorithm.
static void quickSort(Object[] S, Comparator c)
          Sort the elements of array S in nondecreasing order according to comparator c, using the quick-sort algorithm.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Sort

public Sort()
Method Detail

mergeSort

public static void mergeSort(List L,
                             Comparator c)
Sort the elements of list L in nondecreasing order according to comparator c, using the merge-sort algorithm.


merge

public static void merge(List L1,
                         List L2,
                         Comparator c,
                         List L)
Merge two sorted lists, L1 and L2, into a sorted list L.


mergeSort

public static void mergeSort(Object[] orig,
                             Comparator c)
Sort an array of objects with a comparator using nonrecursive merge sort.


merge

protected static void merge(Object[] in,
                            Object[] out,
                            Comparator c,
                            int start,
                            int inc)

quickSort

public static void quickSort(List L,
                             Comparator c)
Sort the elements of list L in nondecreasing order according to comparator c, using a list-based implementation of the quicksort algorithm.


quickSort

public static void quickSort(Object[] S,
                             Comparator c)
Sort the elements of array S in nondecreasing order according to comparator c, using the quick-sort algorithm. Most of the work is done by the auxiliary recursive method quickSortStep.


main

public static void main(String[] argv)
                 throws IOException
Throws:
IOException

datastructures