org.PingOO.DLAI.lib.util
Class QuickSort
java.lang.Object
|
+--org.PingOO.DLAI.lib.util.QuickSort
- public class QuickSort
- extends java.lang.Object
A quick sort algorithm implementation.
Base on the generic version of C.A.R Hoare's Quick Sort algorithm.
This will handle arrays that are already sorted, and arrays with duplicate keys.
- Since:
- PingOO 2.0
- Version:
- 2.0
- Author:
- Fabrice Bouyé (bouye@cur-archamps.fr)
|
Constructor Summary |
private |
QuickSort()
Hides the constructor from the outside. |
|
Method Summary |
static void |
sort(java.lang.Object[] objectArray)
Sorts a object array using a quick sort algorithm and a lexicographical order. |
static void |
sort(java.lang.Object[] objectArray,
int low,
int high)
Sorts a object array using a quick sort algorithm and a lexicographical order. |
private static void |
swapObjects(java.lang.Object[] objectArray,
int i,
int j)
Swaps two objects in a array. |
| Methods inherited from class java.lang.Object |
,
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
registerNatives,
toString,
wait,
wait,
wait |
QuickSort
private QuickSort()
- Hides the constructor from the outside.
sort
public static final void sort(java.lang.Object[] objectArray)
- Sorts a object array using a quick sort algorithm and a lexicographical order.
- Parameters:
objectArray - The object array to sort.
sort
public static final void sort(java.lang.Object[] objectArray,
int low,
int high)
- Sorts a object array using a quick sort algorithm and a lexicographical order.
- Parameters:
objectArray - The object array to sort.low - Left boundary of array partition.high - Right boundary of array partition.
swapObjects
private static final void swapObjects(java.lang.Object[] objectArray,
int i,
int j)
- Swaps two objects in a array.
- Parameters:
objectArray - The object array in which the elements are to be swappedi - The first index to swapj - The last index to swap