# Class Sorter.InsertionSorter

public class InsertionSorter
extends Sorter.ASorter

A concrete sorter that uses the Insertion Sort technique.

##

InsertionSorter (AOrder)
  The constructor for this class

##

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

##

InsertionSorter

    public  InsertionSorter(AOrder iCompareOp)

  The constructor for this class.

  Parameters:
    iCompareOp - The comparison strategy to use in the sorting.

##

split

    protected int split(Object[] 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. This simply splits off the element at index hi.

  Parameters:
    A - the array A[lo:hi] to be sorted.
    lo - the low index of A.
    hi - the high index of A.
  Returns:
    hi always.

join

    protected void join(Object[] A, int lo, int s, int hi)

  Joins sorted A[lo:s-1] and sorted A[s:hi] into A[lo:hi]. (s = hi) The method performs an in-order insertion of A[hi] into the A[lo, hi-1]

  Parameters:
    A - A[lo:s-1] and A[s:hi] are sorted.
    lo - the low index of A.
    s -
    hi - the high index of A.