/* [Close cover before striking BKD] You too can make BIG MONEY in the exciting field of PAPER SHUFFLING! Mr. TAA of Muddle, Mass. says: "Before I took this course I used to be a lowly bit twiddler. Now with what I learned at MIT Tech I feel really important and can obfuscate and confuse with the best." Mr. MARC had this to say: "Ten short days ago all I could look forward to was a dead-end job as a engineer. Now I have a promising future and make really big Zorkmids." MIT Tech can't promise these fantastic results to everyone, but when you earn your MDL degree from MIT Tech your future will be brighter. Send for our free brochure today! 5. Vjezba Zwrevgv v hfcberqvgv ievwrzr fbegvenawn vfgbt cbywn fgehxghen cebvmibywab bqnoenavz nytbevgzbz mn fbeg v xbevfgrpv htenqwrah shaxpvwh dfbeg anq: n) cbywrz f xywhprz trarevenavz shaxpvwbz tra_nee vm wrqar bq cergubqavu iwrmov o) cbywrz f enfghpvz ievwrqabfgvzn xywhpn (fbegvenab cbywr) Qbqngnx: Ancvfngv cebtenz zretr xbwv fcnwn qin vyv ivfr fbegvenavu cbywn h wrqab fbegvenab cbywr. Nygreangviab, ancvfngv cebtenz xbwv fcnwn qivwr vyv ivfr cergubqab fbegvenavu qngbgrxn h fbegvenav ermhygng xbwv fr mncvfhwr an fgnaqneqav vmynm. Cbmvi cebtenzn wr: zretr svyr1 svyr2 ... */ // blondez rulz.. // (c) kreator // 19:51 1997.12.06 #include #include #include #include #include #define MAX 6000 void gen_arr(long *polje, int n, long donja, long gornja) { int i; randomize(); if (gornja==donja) for (i=0; ipolje[j]) { tmp=polje[i]; polje[i]=polje[j]; polje[j]=tmp; } } int main(void) { long matrixx[MAX]; clock_t t1, t2; float dt1, dt2; /* i'd like to use here the precision Zen timer.. that uses the 8253 timer to time the performance of code that takes less than about 54 milliseconds to execute, with a resolution of better than 10 microseconds. anyway.. it's kinnda hard to implement here so i just counted out clock ticks listening to prodigy.. RULEZ! */ gen_arr(matrixx, MAX, 1, MAX); t1=clock(); qsort((void *)matrixx, MAX, sizeof(matrixx[0]), compare_function); t2=clock(); dt1=((float)(t2-t1))/CLK_TCK; gen_arr(matrixx, MAX, 1, MAX); t1=clock(); sort(matrixx, MAX); t2=clock(); dt2=((float)(t2-t1))/CLK_TCK; printf("\nNumber of elements is %d..\n\nTest - unsorted array\nQUICK SORT time:\t%f\nBUBBLE SORT time:\t%f\n", MAX, dt1, dt2); t1=clock(); qsort((void *)matrixx, MAX, sizeof(matrixx[0]), compare_function); t2=clock(); dt1=((float)(t2-t1))/CLK_TCK; t1=clock(); sort(matrixx, MAX); t2=clock(); dt2=((float)(t2-t1))/CLK_TCK; printf("\nTest - sorted array\nQUICK SORT time:\t%f\nBUBBLE SORT time:\t%f\n", dt1, dt2); return 0; }