CITS2200
Interface Sort


public interface Sort

A class to give a comaprative view of common sorting algorithms. The maintains a private static variable that counts the number of array assignments that are performed (as an approximate measure of the complexity of the algorithm.


Method Summary
 int getCount()
          Returns the number of array assignment operations performed by this class since the count variable was rest.
 void insertionSort(long[] a)
          Executes the insertion sort algorithm sorting the argument array.
 void mergeSort(long[] a)
          Executes the merge sort algorithm sorting the argument array.
 void quickSort(long[] a)
          Executes the quicksort algorithm sorting the argument array.
 void reset()
          Resets the counter variable to 0
 

Method Detail

getCount

int getCount()
Returns the number of array assignment operations performed by this class since the count variable was rest.

Returns:
the number of assignments

reset

void reset()
Resets the counter variable to 0


insertionSort

void insertionSort(long[] a)
Executes the insertion sort algorithm sorting the argument array. There is no return as the parameter is to be mutated.

Parameters:
a - the array of long integers to be sorted

mergeSort

void mergeSort(long[] a)
Executes the merge sort algorithm sorting the argument array. There is no return as the parameter is to be mutated.

Parameters:
a - the array of long integers to be sorted

quickSort

void quickSort(long[] a)
Executes the quicksort algorithm sorting the argument array. There is no return as the parameter is to be mutated.

Parameters:
a - the array of long integers to be sorted