Class InsertionSorter
- public class InsertionSorter
- extends ASorter
Inserts A[s] into A[lo:s-1], assuming A[lo;s-1] is sorted.
Correponds to splitting the array at the high index, sort the two parts, and join
the sorted part. The splitting is easy. It's the join that requires some work.
As such, insertion sort is in the same family as merge sort.
- Author:
- Dung X. Nguyen - Copyright 1999 - all rights reserved.

Singleton

InsertionSorter
()

join
(int[], int, int, int)
- Inserts A[s] into the array A[lo:s-1], shifting elements of A to the right if necessary
main
(String[])
- A simple test case for InsertionSorter
split
(int[], int, int)
- Splits the array at the end (i

Singleton
public static final InsertionSorter Singleton

InsertionSorter
private InsertionSorter()

split
public int split(int[] A, int lo, int hi)
- Splits the array at the end (i.e. high index).
- Parameters:
- A - array of integers.
- lo - low index of A, < hi.
- hi - high index of A, > lo.
- Returns:
- hi.
join
public void join(int[] A, int lo, int s, int hi)
- Inserts A[s] into the array A[lo:s-1], shifting elements of A to the right if necessary.
- Parameters:
- A - A[lo:s-1], A[s:hi] are sorted
- lo -
- s - == hi.
- hi -
main
public static void main(String[] args)
- A simple test case for InsertionSorter.