org.wcb.common
Class ArraySorter
java.lang.Object
org.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.
|
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 |
ArraySorter
public ArraySorter()
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 sortcmp - 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 arracmp - Comparator objectleft - start postion of the left arrayright - start postion of the right array
Copyright © 1999-2004 Walter Bogaardt. All Rights Reserved.