Class Quicksort

java.lang.Object
  |
  +--Quicksort

public class Quicksort
extends java.lang.Object

Quicksort is a setup for sorting an array of objects using the Quicksort algorithm. Comparisons are done with an arbitrary Compartor.


Field Summary
private  java.lang.Object[] a
          The array of Objects to be sorted.
 
Constructor Summary
Quicksort(java.lang.Object[] array)
          Constructor for the Quicksort setup
 
Method Summary
 void sort(java.util.Comparator comp)
          Sort the array in place using the argument comparator
 void sort(int low, int high, java.util.Comparator comp)
          Sort the array elements at indices from low to high, inclusive.
 void swap(int i, int j)
          swap(i, j) interchanges the values in a[i] and a[j]
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

a

private java.lang.Object[] a
The array of Objects to be sorted.

Constructor Detail

Quicksort

public Quicksort(java.lang.Object[] array)
Constructor for the Quicksort setup

Method Detail

sort

public void sort(java.util.Comparator comp)
Sort the array in place using the argument comparator


sort

public void sort(int low,
                 int high,
                 java.util.Comparator comp)
Sort the array elements at indices from low to high, inclusive.


swap

public void swap(int i,
                 int j)
swap(i, j) interchanges the values in a[i] and a[j]