// 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. #include "book.h" #include "compare.h" #include "permute.h" // This is a generalized version of "largest". It is generalized to use // a template type for the array elements, and a comparator. // Return position of the largest value in array of size n template< class E, class Comp> int largestt(E array[], int n) { int currlarge = 0; // Holds position of largest element for (int i=1; i"); n = atoi(argv[1]); A = new int[n]; B = new Int[n]; C = new Int*[n]; // First, make a random permutation for (i=0; i(A, n); cout << "The largest value position is " << temp << endl; cout << "The value is " << A[temp] << "\n\n"; for (i=0; i(B, n); cout << "The largest value position is " << temp << endl; cout << "The value is " << B[temp] << "\n\n"; for (i=0; i(C, n); cout << "The largest value position is " << temp << endl; cout << "The value is " << C[temp] << "\n"; return 0; }