// 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. // A program to compare the time required to do a simple binsort // using two arrays versus a binsort that swaps "in place". Thus, // the first version uses twice the space (since it requires an // auxilliary array), while the second version does extra copying // (because a swap is more expensive than a direct copy). #include "book.h" #include "permute.h" #define COUNT 100 typedef int E; #include "list.h" int MaxKeyValue = 100; // dummy declaration for binsort.book syntax check // Check syntax for binsort code template void binsort(E A[], int n) { List B[MaxKeyValue]; E item; for (int i=0; i"); n = atoi(argv[1]); A = new E[n]; B = new E[n]; Randomize(); for (i=0; i