// From the software distribution accompanying the textbook // "A Practical Introduction to Data Structures and Algorithm Analysis, // Third Edition (C++)" by Clifford A. Shaffer. // Source code Copyright (C) 2007-2011 by Clifford A. Shaffer. // Selection Sort implementation and timing test driver #include "book.h" // Include comparator functions #include "compare.h" // Selection sort implementation template void selsort(E A[], int n) { // Selection Sort for (int i=0; ii; j--) // Find the least value if (Comp::prior(A[j], A[lowindex])) lowindex = j; // Put it in place swap(A, i, lowindex); } } template void sort(E* array, int n) { selsort(array, n); } #include "sortmain.cpp" int main(int argc, char** argv) { return sortmain(argc, argv); }