int main() { //test(); TestQuickSort(); system("pause"); return 0; }
int main(int argc, const char *argv[]) { // int arr[] = { 4, 9, 1, 3, 100, 20, 60 ,11}; int *pLargeArr; size_t dwLargeArrLen = 100000000; GenerateArr(pLargeArr, dwLargeArrLen); clock_t begin = clock(); Test4Def(); if( argc > 1) { const char *pSort = argv[1]; if( strncmp(pSort,"-select",sizeof("-select")) == 0 ) { TestSelectSort(pLargeArr,dwLargeArrLen); } if( strncmp(pSort,"-insert",sizeof("-insert")) == 0 ) { TestInsertSort(pLargeArr, dwLargeArrLen); } if( strncmp(pSort,"-quick",sizeof("-quick")) == 0 ) { TestQuickSort(pLargeArr, 0, dwLargeArrLen - 1); } if( strncmp(pSort,"-merge",sizeof("-merge")) == 0 ) { TestMergeSort(pLargeArr, 0, dwLargeArrLen); } if( strncmp(pSort,"-shell",sizeof("-shell")) == 0 ) { TestShellSort(pLargeArr, dwLargeArrLen); } } clock_t end = clock(); clock_t cost = end - begin; printf("cost time:%lf\n", (double)cost / CLOCKS_PER_SEC); return 0; }
int main(int argc, char **argv) { int arraySize = MAX_SIZE; //arbitrary large array for extenuating if(argc == 2) arraySize = atoi(argv[1]); //let user easily change the size of test arrays printf("Testing sorting algorithms with arrays of SIZE: '%s'\n", argv[1]); TestMergeSort( arraySize ); printf("\n"); //formatting TestInsertionSort( arraySize ); printf("\n"); //formatting TestQuickSort( arraySize ); printf("\n"); //formatting return SUCCESS; }