// Insertion Sort: Sort first N items in array A // Etype must have copy constructor, operator=, and operator< // This is taken directly form the book. template void InsertionSort( Etype A[ ], int N ) { for( int P = 1; P < N; P++ ) { Etype Tmp = A[ P ]; int j; for( j = P; j > 0 && Tmp < A[ j-1 ]; j-- ) A[ j ] = A[ j-1 ]; A[ j ] = Tmp; } }