// From the software distribution accompanying the textbook // "A Practical Introduction to Data Structures and Algorithm Analysis, // Third Edition" by Clifford A. Shaffer, Prentice Hall, 2007. // Source code Copyright (C) 2006 by Clifford A. Shaffer. #include using namespace std; #include "book.h" // Include comparator functions #include "compare.h" // Include permutation function #include "permute.h" // Implementation for max heap #include "maxheap.ht" // Test out the max heap implementation int main(int argc, char** argv) { int i, j; int n; Int* A[20]; Int* B[20]; Int C[10] = {73, 6, 57, 88, 60, 34, 83, 72, 48, 85}; maxheap BH(B, 0, 20); maxheap Test(C, 10, 10); if (argc != 2) { cout << "Usage: heap \n"; exit(-1); } n = atoi(argv[1]); if (n > 20) { cout << "heap size " << n << " too big.\n"; exit(-1); } Randomize(); for (i=0; i AH(A, n, 20); Int* AHval; for (i=0; i