Class ArraySorter

java.lang.Object
  extended by ArraySorter

public class ArraySorter
extends Object

Class ArraySorter has an array and can do different sorts on it

Author:
Barb Ericson

Constructor Summary
ArraySorter(int[] theArray)
          Constructor that takes the array to sort
 
Method Summary
 void insertionSort()
          Method to do an insertion sort on the array
static void main(String[] args)
           
 void mergeSort()
          Method to do a merge sort of the array
 int partition(int left, int right)
          Method to partition the array around a pivot point.
 void quicksort(int from, int to)
          Do the quicsort on the array from the passed from to the passed to indicies
 void selectionSort()
          Method to do a selection sort on the array
static void testInsertionSort()
          Method to test insertion sort
static void testMergeSort()
           
static void testQuicksort()
           
static void testSelectionSort()
          Method to test selection sort
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArraySorter

public ArraySorter(int[] theArray)
Constructor that takes the array to sort

Parameters:
theArray - the array to sort
Method Detail

selectionSort

public void selectionSort()
Method to do a selection sort on the array


testSelectionSort

public static void testSelectionSort()
Method to test selection sort


insertionSort

public void insertionSort()
Method to do an insertion sort on the array


testInsertionSort

public static void testInsertionSort()
Method to test insertion sort


mergeSort

public void mergeSort()
Method to do a merge sort of the array


testMergeSort

public static void testMergeSort()

quicksort

public void quicksort(int from,
                      int to)
Do the quicsort on the array from the passed from to the passed to indicies

Parameters:
from - the index to start from
to - the index to stop at

partition

public int partition(int left,
                     int right)
Method to partition the array around a pivot point.

Parameters:
left - the left index
right - the right index
Returns:
the index of the pivot point all element in the array with an index less than the returned index are less than the value at the pivot index and all values in the array with an index the pivot value are to the right of the pivot index

testQuicksort

public static void testQuicksort()

main

public static void main(String[] args)