Class ASorter
- public abstract class ASorter
- extends Object
Abstract Comparison-based Sorting Algorithm, based on Susan Merritt's taxonomy :
"An Inverted Taxonomy of Sorting Algorithms," Communication of the ACM, Jan. 1985,
Volume 28, Number 1, pp. 96-99. The template method pattern is used to implement
this taxonomy.
- Author:
- Dung X. Nguyen - Copyright 1999 - All rights reserved.

join
(int[], int, int, int)
- Joins sorted A[lo:s-1] and sorted A[s:hi] into A[lo:hi]
sort
(int[], int, int)
- Sorts by doing a split-sort-sort-join
split
(int[], int, int)
- Splits A[lo:hi] into A[lo:s-1] and A[s:hi] where s is the returned value of this function

sort
public final void sort(int[] A, int lo, int hi)
- Sorts by doing a split-sort-sort-join. Splits the original array into two subarrays,
recursively sorts the split subarrays, then re-joins the sorted subarrays together.
This is the template method. It calls the abstract methods split and join to do
the work. All comparison-based sorting algorithms are concrete subclasses with
specific split and join methods.
- Parameters:
- A - the array A[lo:hi] to be sorted.
- lo - the low index of A.
- hi - the high index of A.
split
public abstract int split(int[] A, int lo, int hi)
- Splits A[lo:hi] into A[lo:s-1] and A[s:hi] where s is the returned value of this function.
- Parameters:
- A - the array A[lo:hi] to be sorted.
- lo - the low index of A.
- hi - the high index of A.
join
public abstract void join(int[] A, int lo, int s, int hi)
- Joins sorted A[lo:s-1] and sorted A[s:hi] into A[lo:hi].
- Parameters:
- A - A[lo:s-1] and A[s:hi] are sorted.
- lo - the low index of A.
- hi - the high index of A.