Class QuickSorter


public class QuickSorter
extends ASorter
Sorts by first splitting the array into two subarrays: one is less or equal to the first element of the original array, the other is greater or equal to the same first element. Then recursively sorts the subarrays to make the original array sorted. This algorithm is due to Tony Hoare. In Merritt's sorting taxonomy, this algorithm belongs to the family of sorting where the splitting is hard and the joining is easy.

Author:
Dung X. Nguyen - Copyright 1999 - All rights reserved.

Variable Index

 o Singleton

Constructor Index

 o QuickSorter ()

Method Index

 o join (int[], int, int, int)
 o main (String[])
 o split (int[], int, int)
Splits A[lo:hi] in such a way that A[lo:s-1] <= A[s:hi] for some s

Variables

 o Singleton
public static final QuickSorter Singleton

Constructors

 o QuickSorter
private  QuickSorter()

Methods

 o split
public int split(int[] A, int lo, int hi)
Splits A[lo:hi] in such a way that A[lo:s-1] <= A[s:hi] for some s.

Parameters:
A -
lo - < hi.
hi - > lo.
Returns:
s such that A[lo:s-1] <= A[s:hi]
 o join
public void join(int[] A, int lo, int s, int hi)
Parameters:
A - A[lo:s-1] and A[s:hi] are sorted, and A[lo:s-1] <= A[s:hi].
lo -
s - in [lo:hi].
hi -
 o main
public static void main(String[] args)