Listing 1 Insertion Sort function template

// Copyright (C) 1992 by Nicholas Wilt. All rights reserved.

template<class T>
void
InsertionSort(T *base, int n)
{
   for (int i = 1; i < n; i++) {
      T temp = base[i];
      for (int j = i; j && temp < base[j - 1]; j--)
         base[j] = base[j - 1];
      base[j] = temp;
   }
}
/* End of File */