org.wcb.common
Class ArraySorter

java.lang.Object
  extended byorg.wcb.common.ArraySorter

public class ArraySorter
extends java.lang.Object

This is a version of C.A.R Hoare's Quick Sort algorithm. This will handle arrays that are already sorted??, and arrays with duplicate keys. Requires that vector contain items that implement Comparable, or that a Comparator be provided.


Constructor Summary
ArraySorter()
           
 
Method Summary
static void sort(java.lang.Object[] array, Comparator cmp)
          this allows the use of the quick sort algorithm
protected static void sort(java.lang.Object[] array, Comparator cmp, int left, int right)
          Takes the array and comparitor and starts sorting
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArraySorter

public ArraySorter()
Method Detail

sort

public static void sort(java.lang.Object[] array,
                        Comparator cmp)
this allows the use of the quick sort algorithm

Parameters:
array - The object array to sort
cmp - comparator object.

sort

protected static void sort(java.lang.Object[] array,
                           Comparator cmp,
                           int left,
                           int right)
Takes the array and comparitor and starts sorting

Parameters:
array - the object arra
cmp - Comparator object
left - start postion of the left array
right - start postion of the right array


Copyright © 1999-2004 Walter Bogaardt. All Rights Reserved.