interface SortingAlgorithm
needs to be implemented
by any sorting algorithm tested by the AlgorithmTest environment.
Method Summary | |
int[] |
createSortIndex(java.lang.Comparable[] data)
createSortIndex should return a sort index
for Comparable |
int[] |
createSortIndex(int[] data)
Instead of modifying the order of data in the original array, createSortIndex should create and return an array
of indices into the original array in sort order. |
void |
sortInPlace(java.lang.Comparable[] data)
sortInPlace sorts object arrays that
meet the Comparable interface so that
comparisons may be done by called the compareTo
method of the objects. |
void |
sortInPlace(int[] data)
sortInPlace should sort the given integer data
in the same array. |
Methods inherited from interface edu.gwu.algtest.Algorithm |
getName, setPropertyExtractor |
Method Detail |
public void sortInPlace(int[] data)
sortInPlace
should sort the given integer data
in the same array.data
- an int[]
valuepublic void sortInPlace(java.lang.Comparable[] data)
sortInPlace
sorts object arrays that
meet the Comparable
interface so that
comparisons may be done by called the compareTo
method of the objects.data
- a Comparable[]
valuepublic int[] createSortIndex(int[] data)
createSortIndex
should create and return an array
of indices into the original array in sort order. Thus, if
data[0]=10, data[1]=15, data[2]=5 the returned array
should contain 2, 0, 1.data
- an int[]
valueint[]
valuepublic int[] createSortIndex(java.lang.Comparable[] data)
createSortIndex
should return a sort index
for Comparable
- Parameters:
data
- a Comparable[]
value- Returns:
- an
int[]
value