#include #include #include #include int *genCGPA ( int n ) { double x; int *A, i; A = (int *)malloc(n * sizeof(int)); for (i=0; i 1) n = atoi(argv[1]); else scanf("%d", &n); srand((unsigned int)time(NULL)); c1 = clock(); A = genCGPA(n); B = cpyCGPA(A,n); C = cpyCGPA(A,n); c2 = clock(); printf("+++ Array generation time = %10.6lf sec\n", (double)(c2-c1)/(double)CLOCKS_PER_SEC); c1 = clock(); quicksort(A,n); c2 = clock(); printf("+++ Quick sort time = %10.6lf sec\n", (double)(c2-c1)/(double)CLOCKS_PER_SEC); c1 = clock(); countingsort1(B,n); c2 = clock(); printf("+++ Counting sort 1 time = %10.6lf sec\n", (double)(c2-c1)/(double)CLOCKS_PER_SEC); c1 = clock(); countingsort2(C,n); c2 = clock(); printf("+++ Counting sort 2 time = %10.6lf sec\n", (double)(c2-c1)/(double)CLOCKS_PER_SEC); cmpCGPA(A,B,n); cmpCGPA(A,C,n); free(A); free(B); free(C); exit(0); }