sorter.c
static void insertionSort(int* inputArray, int length)
{
    int i=1;
    int j=0;
    for(i=1;i<length;i++)
    {
        int key = inputArray[i]; 
        j=i-1; 
        while((j>=0) && (inputArray[j]>key))
        {
            inputArray[j+1]= inputArray[j];
            j--;
        }
        inputArray[j+1]= key; 
    } 
}
/**
 * Insertion worst case is O(N^2), avg is O(N^2)
 * Stable
 * In-Place
 * Good performance if array is already nearly sorted, since number of swaps required will be less
 */
Insertion worst case is O(N^2), avg is O(N^2)
Stable
In-Place
Good performance if array is already nearly sorted, since number of swaps required will be less
Insertion worst case is O ( N^2 ) avg is O ( N^2 ) Stable In - Place Good performance if array is already nearly sorted since number of swaps required will be less
static void insertionSort(int* inputArray, int length)
{
    int i=1;
    int j=0;
    for(i=1;i<length;i++)
    {
        int key = inputArray[i]; 
        j=i-1; 
        while((j>=0) && (inputArray[j]>key))
        {
            inputArray[j+1]= inputArray[j];
            j--;
        }
        inputArray[j+1]= key; 
    } 
}
static void insertionSort ( int * inputArray , int length ) { int i = 1 ; int j = 0 ; for ( i = 1 ; i < length ; i ++ ) { int key = inputArray [ i ] ; j = i - 1 ; while ( ( j >= 0 ) && ( inputArray [ j ] > key ) ) { inputArray [ j + 1 ] = inputArray [ j ] ; j -- ; } inputArray [ j + 1 ] = key ; } }
Insertion worst case is O(N^2), avg is O(N^2)
 Stable
 In-Place
 Good performance if array is already nearly sorted, since number of swaps required will be less
Insertion worst case is O ( N^2 ) avg is O ( N^2 ) Stable In - Place Good performance if array is already nearly sorted since number of swaps required will be less