// Sorting main function for running timings. // To use: [+/-] // + means increasing values, - means decreasing value and no // parameter means random values; // controls the size of an individual test out // of an array of size ARRAYSIZE. For example, inssort 10 will run // a series of sorts on lists of size 10. // controls the threshold parameter for certain sorts, e.g., // cutoff point for quicksort sublists. long count1 = 0; long count2 = 0; #define ARRAYSIZE 1000000 #define print(X, Y) /* void print(int* array, int listsize) { for(int i=0; i 4)) { cout << "Usage: [+/-] []\n"; exit(-1); } currarg = 1; if (argv[currarg][0] == '-') { input = -1; currarg++; } else if (argv[currarg][0] == '+') { input = 1; currarg++; } listsize = atoi(argv[currarg++]); if (argc > currarg) THRESHOLD = atoi(argv[currarg]); if ((listsize > ARRAYSIZE) || (listsize < 0)) { cout << "Selected list size is too big\n"; exit(-1); } cout << "Input: " << input << ", size: " << listsize << ", threshold: " << THRESHOLD << "\n"; if (input == -1) for (i=0; i(&array[i], listsize); print(&array[i], listsize); } cout << "Sort with list size " << listsize << ", array size " << ARRAYSIZE << ", and threshold " << THRESHOLD << ": " << Gettime() << " seconds\n"; /* cout << "Count1 is " << count1 << ", Count2 is " << count2 << "\n"; cout << "Qcomps is " << qcomps << ", icomps is " << icomps << ", and the total is " << qcomps + icomps << endl; */ for (i=0; i array[j]) cout << "ERROR!!!\n"; return(0); }